Versions in this module Expand all Collapse all v0 v0.0.1 May 1, 2025 Changes in this version + const DefaultFilterMaxLightness + const DefaultFilterMinLightness + const DefaultLightnessWeight + const DefaultMaximumColorCount + const DefaultPopulationWeight + const DefaultResizeArea + const DefaultSaturationWeight + const MaxDarkLightness + const MaxMutedSaturation + const MaxNormalLightness + const MinLightLightness + const MinNormalLightness + const MinVibrantSaturation + const TargetDarkLightness + const TargetLightLightness + const TargetMutedSaturation + const TargetNormalLightness + const TargetVibrantSaturation + var DefaultFilter = NewLightnessFilter(DefaultFilterMinLightness, DefaultFilterMaxLightness) + var DefaultScaler = draw.ApproxBiLinear + var HSLModel = color.ModelFunc(func(c color.Color) color.Color { ... }) + var QuantizedColorGenerator = func(r, g, b uint8) QuantizedColor + var QuantizedColorModel = color.ModelFunc(func(c color.Color) color.Color { ... }) + var RGBAIntModel = color.ModelFunc(func(c color.Color) color.Color { ... }) + func ScaleImageDown(src image.Image, resizeArea uint64, scaler draw.Scaler) image.Image + type ColorCutQuantizer struct + func NewColorCutQuantizer() *ColorCutQuantizer + func NewColorCutQuantizerWithFilters(filters []Filter) *ColorCutQuantizer + func (q *ColorCutQuantizer) Quantize(p color.Palette, m image.Image) color.Palette + func (q *ColorCutQuantizer) Swatches(colorCount uint32, m image.Image) []*Swatch + type DefaultScorer struct + func (s DefaultScorer) Score(swatch *Swatch) float64 + type Filter interface + IsAllowed func(c color.Color) bool + func NewLightnessFilter(blackMaxLightness float64, whiteMinimumLightness float64) Filter + type HSL struct + A uint8 + H float64 + L float64 + S float64 + func (c HSL) RGBA() (uint32, uint32, uint32, uint32) + func (c HSL) String() string + type Palette struct + func (p *Palette) ColorForTarget(target *Target, defaultColor uint32) uint32 + func (p *Palette) DarkMutedColor(defaultColor uint32) uint32 + func (p *Palette) DarkMutedSwatch() *Swatch + func (p *Palette) DarkVibrantColor(defaultColor uint32) uint32 + func (p *Palette) DarkVibrantSwatch() *Swatch + func (p *Palette) LightMutedColor(defaultColor uint32) uint32 + func (p *Palette) LightMutedSwatch() *Swatch + func (p *Palette) LightVibrantColor(defaultColor uint32) uint32 + func (p *Palette) LightVibrantSwatch() *Swatch + func (p *Palette) MutedColor(defaultColor uint32) uint32 + func (p *Palette) MutedSwatch() *Swatch + func (p *Palette) SwatchForTarget(target *Target) *Swatch + func (p *Palette) Swatches() []*Swatch + func (p *Palette) Targets() []*Target + func (p *Palette) VibrantColor(defaultColor uint32) uint32 + func (p *Palette) VibrantSwatch() *Swatch + type PaletteBuilder struct + func NewPaletteBuilder(image image.Image) *PaletteBuilder + func (b *PaletteBuilder) AddFilter(filter Filter) *PaletteBuilder + func (b *PaletteBuilder) AddTarget(target *Target) *PaletteBuilder + func (b *PaletteBuilder) ClearFilters() *PaletteBuilder + func (b *PaletteBuilder) ClearRegion() *PaletteBuilder + func (b *PaletteBuilder) ClearTargets() *PaletteBuilder + func (b *PaletteBuilder) Generate() *Palette + func (b *PaletteBuilder) MaximumColorCount(colors uint32) *PaletteBuilder + func (b *PaletteBuilder) Region(region image.Rectangle) *PaletteBuilder + func (b *PaletteBuilder) ResizeImageArea(area uint64) *PaletteBuilder + func (b *PaletteBuilder) Scaler(scaler draw.Scaler) *PaletteBuilder + type PriorityQueue interface + Len func() int + Offer func(items ...interface{}) + Poll func() interface{} + func NewPriorityQueue(initialCapacity uint32, priorityFunction func(interface{}) uint32) PriorityQueue + type QuantizedColor uint16 + func (q QuantizedColor) ApproximateBlue() uint8 + func (q QuantizedColor) ApproximateGreen() uint8 + func (q QuantizedColor) ApproximateRGBA() uint32 + func (q QuantizedColor) ApproximateRed() uint8 + func (q QuantizedColor) QuantizedBlue() uint8 + func (q QuantizedColor) QuantizedGreen() uint8 + func (q QuantizedColor) QuantizedRed() uint8 + func (q QuantizedColor) RGBA() (uint32, uint32, uint32, uint32) + func (q QuantizedColor) SwapRedBlue() QuantizedColor + func (q QuantizedColor) SwapRedGreen() QuantizedColor + type QuantizedColorSlice []QuantizedColor + func (s QuantizedColorSlice) Len() int + func (s QuantizedColorSlice) Less(i, j int) bool + func (s QuantizedColorSlice) Swap(i, j int) + type RGBAInt uint32 + func (c RGBAInt) PackedRGB() uint32 + func (c RGBAInt) PackedRGBA() uint32 + func (c RGBAInt) RGBA() (uint32, uint32, uint32, uint32) + func (c RGBAInt) String() string + type Scorer interface + Score func(*Swatch) float64 + func NewDefaultScorer(target Target, maxPopulation uint32) Scorer + type ScorerFactory func(Target, []*Swatch) Scorer + var DefaultScorerFactory ScorerFactory + type SubImager interface + SubImage func(r image.Rectangle) image.Image + type Swatch struct + func NewSwatch(color color.Color, population uint32) *Swatch + func (s *Swatch) HSL() HSL + func (s *Swatch) RGBAInt() RGBAInt + func (s Swatch) Color() color.Color + func (s Swatch) Population() uint32 + type Target struct + var DarkMuted *Target + var DarkVibrant *Target + var LightMuted *Target + var LightVibrant *Target + var Muted *Target + var Vibrant *Target + func (t Target) IsExclusive() bool + func (t Target) MaximumLightness() float64 + func (t Target) MaximumSaturation() float64 + func (t Target) MinimumLightness() float64 + func (t Target) MinimumSaturation() float64 + func (t Target) Scorer(swatches []*Swatch) Scorer + func (t Target) String() string + func (t Target) TargetLightness() float64 + func (t Target) TargetSaturation() float64 + type TargetBuilder struct + func NewTargetBuilder() *TargetBuilder + func NewTargetBuilderFromTarget(target *Target) *TargetBuilder + func (b *TargetBuilder) Build() *Target + func (b *TargetBuilder) IsExclusive(exclusive bool) *TargetBuilder + func (b *TargetBuilder) MaximumLightness(value float64) *TargetBuilder + func (b *TargetBuilder) MaximumSaturation(value float64) *TargetBuilder + func (b *TargetBuilder) MinimumLightness(value float64) *TargetBuilder + func (b *TargetBuilder) MinimumSaturation(value float64) *TargetBuilder + func (b *TargetBuilder) ScorerFactory(factory ScorerFactory) *TargetBuilder + func (b *TargetBuilder) TargetLightness(value float64) *TargetBuilder + func (b *TargetBuilder) TargetSaturation(value float64) *TargetBuilder