Documentation
¶
Index ¶
- Variables
- func AdjustToContrastRatio(c1, c2 string, cr0 float64) (string, error)
- func Blue(hex string) (float64, error)
- func ContrastRatio(c1, c2 string) (float64, error)
- func DarkPalette(c string, n int) ([]string, error)
- func Darken(hex string, a float64) (string, error)
- func Desaturate(hex string, a float64) (string, error)
- func Green(hex string) (float64, error)
- func Hue(hex string) (float64, error)
- func Invert(hex string) (string, error)
- func LightPalette(c string, n int) ([]string, error)
- func Lighten(hex string, a float64) (string, error)
- func Lightness(hex string) (float64, error)
- func Luminance(c string) (float64, error)
- func Mix(c1, c2 string, w float64) (string, error)
- func MixPalette(c1, c2 string, n int) ([]string, error)
- func Red(hex string) (float64, error)
- func Saturate(hex string, a float64) (string, error)
- func Saturation(hex string) (float64, error)
- func SetBlue(hex string, b float64) (string, error)
- func SetGreen(hex string, g float64) (string, error)
- func SetHue(hex string, h float64) (string, error)
- func SetLightness(hex string, l float64) (string, error)
- func SetRed(hex string, r float64) (string, error)
- func SetSaturation(hex string, s float64) (string, error)
Constants ¶
This section is empty.
Variables ¶
var WebColors = map[string]string{}/* 148 elements not displayed */
Functions ¶
func AdjustToContrastRatio ¶
AdjustToContrastRatio adjusts the lightness of the color c1 so that the contrast ratio between c1 and c2 is as close as possible to the given contrast ratio cr0.
func ContrastRatio ¶
ContrastRatio returns the CR of 2 colors.
func Darken ¶
Darken darkens a color by subtracting the provided value from its lightness channel and returns the result and an error.
func Desaturate ¶
Desaturate unsaturates a color by subtracting the provided value from its saturation channel and returns the result and an error.
func Lighten ¶
Lighten lightens a color by adding the provided value to its lightness channel and returns the result and an error.
func Luminance ¶
Luminance returns the relative Luminance of a color. https://en.wikipedia.org/wiki/Relative_luminance
func Mix ¶
Mix mixes two colors using the given weight (of the first color) and returns the result and an error.
func MixPalette ¶
MixPalette makes a slice of colors representing a palette of n equally distanced colors between c1 and c2 (c1 and c2 included) and returns it with an error.
func Saturate ¶
Saturate saturates a color by adding the provided value to its saturation channel and returns the result and an error.
func Saturation ¶
Saturation returns the saturation channel of a color and an error.
func SetBlue ¶
SetBlue sets the blue channel of a color to the provided value and returns the result and an error.
func SetGreen ¶
SetGreen sets the green channel of a color to the provided value and returns the result and an error.
func SetHue ¶
SetHue sets the hue channel of a color to the provided value and returns the result and an error.
func SetLightness ¶
SetLightness sets the lightness channel of a color to the provided value and returns the result and an error.
Types ¶
This section is empty.