Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // FNVHasher is the alternative hasher for color hashing. FNVHasher = func() hash.Hash32 { return fnv.New32a() } // DJB2Hasher is the string hasher used for color hashing. DJB2Hasher = newDJB32 )
Functions ¶
func RGBHex ¶
RGBHex converts the given color to a HTML hex color string. The alpha value is ignored.
func SetDefaultHasher ¶
func SetDefaultHasher(hasher Hasher)
SetDefaultHasher sets the default hasher that the package uses.
Types ¶
type HSVHasher ¶
type HSVHasher struct { H func() hash.Hash32 // hashing function S [2]float64 // saturation V [2]float64 // value }
HSVHasher describes a color hasher that accepts saturation and value parameters in the HSV color space.
type Hasher ¶
Hasher describes a string hasher that outputs a color.
var ( // LightColorHasher generates a pastel color name for use with a dark // background. LightColorHasher Hasher = HSVHasher{ FNVHasher, [2]float64{0.3, 0.4}, [2]float64{0.9, 1.0}, } // DarkColorHasher generates a darker, stronger color name for use with a // light background. DarkColorHasher Hasher = HSVHasher{ FNVHasher, [2]float64{0.9, 1.0}, [2]float64{0.6, 0.7}, } )
Click to show internal directories.
Click to hide internal directories.