Documentation ¶
Overview ¶
Utilities for parsing and manipulating colors.
Index ¶
- Constants
- func Equals(first interface{}, second interface{}) bool
- func HslToRgb(hue float64, saturation float64, lightness float64) (uint8, uint8, uint8)
- func HsvToRgb(hue float64, saturation float64, value float64) (uint8, uint8, uint8)
- func RgbToHsl(r float64, g float64, b float64) (float64, float64, float64)
- type Color
- func (self Color) Equals(other interface{}) bool
- func (self Color) HSI() (float64, float64, float64)
- func (self Color) HSL() (float64, float64, float64)
- func (self Color) HSV() (float64, float64, float64)
- func (self Color) RGBA() (uint32, uint32, uint32, uint32)
- func (self Color) RGBA255() (uint8, uint8, uint8, uint8)
- func (self Color) String() string
- func (self Color) StringHSLA() string
- func (self Color) StringRGBA() string
Constants ¶
const ( Invalid lmodel = iota HSI HSL HSV )
Variables ¶
This section is empty.
Functions ¶
func Equals ¶
func Equals(first interface{}, second interface{}) bool
Return whether two colors are equivalent in the 24-bit RGB (RGB255) color space.
func HslToRgb ¶
Given HSL values (where hue is given in degrees (out of 360°), saturation and lightness are [0, 1]), return the corresponding RGB values (where each value is [0, 255]).
Types ¶
type Color ¶
type Color struct {
// contains filtered or unexported fields
}
func Darken ¶
Darken the given color by a certain percent. Consistent with the results of the Sass darken() function.
func Lighten ¶
Lighten the given color by a certain percent. Consistent with the results of the Sass lighten() function.
func MustParse ¶
func MustParse(value interface{}) Color
Parse the given value into a Color or panic.
func (Color) Equals ¶
Return whether the given color is equal to this one in the 24-bit RGB (RGB255) color space
func (Color) HSI ¶
Return the current color as hue (out of 360°), saturation [0, 1], and intensity [0, 1].
func (Color) HSL ¶
Return the current color as hue (out of 360°), saturation [0, 1], and lightness [0, 1].
func (Color) HSV ¶
Return the current color as hue (out of 360°), saturation [0, 1], and value [0, 1].
func (Color) RGBA ¶
Return the current color as a 32-bit uint quad, implementing the color.Color interface.