What it does
go-colorful is a free Go library under the MIT licence for converting, comparing and blending colours. It implements color.Color and supports HEX, RGB and several perceptual colour spaces.
Parse a HEX string or construct a colour in the required space, then request another representation or blend it with a second colour. The README supplies both conversion examples and a gradient written as a PNG. RGB components use zero to one; hue-based models use degrees.
Perceptual-space interpolation can produce colours outside RGB’s valid range. IsValid detects them and Clamped returns a nearby valid colour. Another documented edge case occurs when MakeColor receives fully transparent premultiplied input: its original RGB values cannot be recovered and the conversion reports failure.
The library is free under the MIT licence, with its notice retained in redistributed copies.
Strengths
- The standard Go colour interface connects it to image code.
- Validity checks accompany perceptual blending.
Watch out for
- Blending can produce out-of-range RGB colours.
- Fully transparent premultiplied input loses its original RGB values.
Best for
- Go programs generating gradients or manipulating image colours
Sources
- go-colorful README and worked examples (Oct 27, 2026)
- go-colorful MIT licence (Oct 27, 2026)
