Documentation ¶
Index ¶
- Constants
- func FastHappyPalette(colorsCount int) (colors []colorful.Color)
- func FastWarmPalette(colorsCount int) (colors []colorful.Color)
- func HappyPalette(colorsCount int) ([]colorful.Color, error)
- func SoftPalette(colorsCount int) ([]colorful.Color, error)
- func SoftPaletteEx(colorsCount int, settings SoftPaletteSettings) ([]colorful.Color, error)
- func WarmPalette(colorsCount int) ([]colorful.Color, error)
- type SoftPaletteSettings
Constants ¶
const LAB_DELTA = 1e-6
Variables ¶
This section is empty.
Functions ¶
func FastHappyPalette ¶
Uses the HSV color space to generate colors with similar S,V but distributed evenly along their Hue. This is fast but not always pretty. If you've got time to spare, use LAB (the non-fast below).
func FastWarmPalette ¶
Uses the HSV color space to generate colors with similar S,V but distributed evenly along their Hue. This is fast but not always pretty. If you've got time to spare, use LAB (the non-fast below).
func SoftPalette ¶
A wrapper which uses common parameters.
func SoftPaletteEx ¶
func SoftPaletteEx(colorsCount int, settings SoftPaletteSettings) ([]colorful.Color, error)
Yeah, windows-stype Foo, FooEx, screw you golang... Uses K-means to cluster the color-space and return the means of the clusters as a new palette of distinctive colors. Falls back to K-medoid if the mean happens to fall outside of the color-space, which can only happen if you specify a CheckColor function.
Types ¶
type SoftPaletteSettings ¶
type SoftPaletteSettings struct { // A function which can be used to restrict the allowed color-space. CheckColor func(l, a, b float64) bool // The higher, the better quality but the slower. Usually two figures. Iterations int // Use up to 160000 or 8000 samples of the L*a*b* space (and thus calls to CheckColor). // Set this to true only if your CheckColor shapes the LAB space weirdly. ManySamples bool }