go-colorful

github.com ↗

Work with colour spaces and colour relationships in Go.

SI Score
80/100
Pricing
Open Source AI reading, not confirmed
Free plan
Yes AI reading, not confirmed
Sign-up required
Not confirmed

Ask SI about go-colorful

Answers use saved listing facts and recorded sources.
Homepage screenshot
Screenshot of the go-colorful homepage

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