Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ColorMap = map[string]string{
"blue": "#0000ff",
"green": "#00ff00",
"yellow": "#ffaf33",
"purple": "#af33ff",
"red": "#ff0000",
"teal": "#33ffd1",
"pink": "#ff08c7",
"white": "#ffffff",
"black": "#000000",
}
ColorMap is a map of named colors to hex values
Functions ¶
func GradientColorList ¶
func GradientColorList(gradient GradientTable, length int) []colorful.Color
GradientColorList generates a list of colors for a GradientTable length: the number of colors you want
func GradientPNG ¶
func GradientPNG(gradient GradientTable, h int, w int)
GradientPNG generates a gradient PNG as an example
func HexToColor ¶
func HexToColor(s string) colorful.Color
HexToColor converts a hex string to a Color
Types ¶
type GradientTable ¶
type GradientTable []struct { Col colorful.Color Pos float64 }
GradientTable contains the "keypoints" of the colorgradient you want to generate. The position of each keypoint has to live in the range [0,1]
func (GradientTable) GetInterpolatedColor ¶
func (gt GradientTable) GetInterpolatedColor(t float64) colorful.Color
GetInterpolatedColor is the meat of the gradient computation. It returns an HCL-blend between the two colors around `t`. Note: It relies heavily on the fact that the gradient keypoints are sorted.
Click to show internal directories.
Click to hide internal directories.