Documentation
¶
Overview ¶
Package color provides tools for defining and generating high-contrast color palettes suitable for QR codes and other visual elements.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultPalette = Palette{ ForeGround: color.RGBA{0x00, 0x00, 0x00, 0xff}, BackGround: color.RGBA{0xef, 0xef, 0xef, 0xff}, }
DefaultPalette defines the default system colors (black on light gray).
Functions ¶
func IdentifyColor ¶
IdentifyColor finds the closest color from a list of Color objects using Euclidean distance.
Types ¶
type Color ¶
type Color interface {
// Name returns the descriptive name of the color.
Name() string
// Palette returns the foreground and background RGBA values.
Palette() (foreground color.RGBA, background color.RGBA)
}
Color defines the behavior for color objects.
func DefaultColors ¶
func DefaultColors() []Color
DefaultColors returns a list of all built-in Color objects currently registered.
type Name ¶
type Name string
Name defines a custom type for palette identification.
const ( Black Name = "black" White Name = "white" Gray Name = "gray" Blue Name = "blue" Red Name = "red" Green Name = "green" Yellow Name = "yellow" Magenta Name = "magenta" Cyan Name = "cyan" Orange Name = "orange" Purple Name = "purple" Gold Name = "gold" Silver Name = "silver" Pink Name = "pink" Brown Name = "brown" Lime Name = "lime" Teal Name = "teal" Indigo Name = "indigo" Violet Name = "violet" Crimson Name = "crimson" Olive Name = "olive" Maroon Name = "maroon" SkyBlue Name = "skyblue" Rose Name = "rose" Emerald Name = "emerald" )
type Palette ¶
Palette groups the foreground and background colors for the palette.
func NewPalette ¶
NewPalette returns a Palette based on a Name. It searches the registry for the name; if not found, it returns the DefaultPalette.