Documentation
¶
Overview ¶
Package blcolor contains color creation and manipulation tools.
Package blcolor contains color creation and manipulation tools.
Package blcolor contains color creation and manipulation tools.
Package blcolor contains color creation and manipulation tools.
Index ¶
- Variables
- type Color
- func CMYK(c, m, y, k float64) Color
- func Grey(shade float64) Color
- func GreyHex(shade int) Color
- func HSL(h, s, l float64) Color
- func HSLA(h, s, l, a float64) Color
- func HSV(h float64, s float64, v float64) Color
- func HSVA(h float64, s float64, v float64, a float64) Color
- func Lerp(colorA, colorB Color, t float64) Color
- func Number(value int) Color
- func NumberWithAlpha(value int) Color
- func RGB(r float64, g float64, b float64) Color
- func RGBA(r float64, g float64, b float64, a float64) Color
- func RGBAHex(r int, g int, b int, a int) Color
- func RGBHex(r int, g int, b int) Color
- func RandomGrey() Color
- func RandomGreyRange(min float64, max float64) Color
- func RandomRGB() Color
- func (c Color) AddColor(b Color) Color
- func (c Color) AddRGB(r, g, b float64) Color
- func (c Color) ColorDiff(colorB Color) float64
- func (c Color) ColorDiffPercept(colorB Color) float64
- func (c Color) Contrast(c2 Color) float64
- func (c Color) Equals(colorB Color) bool
- func (c Color) Invert() Color
- func (c Color) Luminance() float64
- func (c Color) Quant(quant int) Color
- func (c Color) Rotate(degrees float64) Color
- func (c Color) Scale(mult float64) Color
- func (c Color) ToCMYK() (float64, float64, float64, float64)
- func (c Color) ToGray() Color
- func (c Color) ToHSL() (float64, float64, float64)
- func (c Color) ToHSV() (float64, float64, float64)
- type Palette
- func (p *Palette) Add(color Color)
- func (p *Palette) AddRGB(r, g, b float64)
- func (p *Palette) AddRGBA(r, g, b, a float64)
- func (p *Palette) Get(index int) Color
- func (p *Palette) GetRandom() Color
- func (p *Palette) Len() int
- func (p *Palette) Less(i, j int) bool
- func (p *Palette) Reverse()
- func (p *Palette) Size() int
- func (p *Palette) Sort()
- func (p *Palette) SortByHue(offset float64)
- func (p *Palette) Swap(i, j int)
Constants ¶
This section is empty.
Variables ¶
var ( Blueviolet = RGBHex(138, 43, 226) Brown = RGBHex(165, 42, 42) Aliceblue = RGBHex(240, 248, 255) Antiquewhite = RGBHex(250, 235, 215) Aqua = RGBHex(0, 255, 255) Aquamarine = RGBHex(127, 255, 212) Azure = RGBHex(240, 255, 255) Beige = RGBHex(245, 245, 220) Bisque = RGBHex(255, 228, 196) Black = RGBHex(0, 0, 0) Blanchedalmond = RGBHex(255, 235, 205) Blue = RGBHex(0, 0, 255) Burlywood = RGBHex(222, 184, 135) Cadetblue = RGBHex(95, 158, 160) Chartreuse = RGBHex(127, 255, 0) Chocolate = RGBHex(210, 105, 30) Coral = RGBHex(255, 127, 80) Cornflowerblue = RGBHex(100, 149, 237) Cornsilk = RGBHex(255, 248, 220) Crimson = RGBHex(220, 20, 60) Cyan = RGBHex(0, 255, 255) Darkblue = RGBHex(0, 0, 139) Darkcyan = RGBHex(0, 139, 139) Darkgoldenrod = RGBHex(184, 134, 11) Darkgray = RGBHex(169, 169, 169) Darkgreen = RGBHex(0, 100, 0) Darkgrey = RGBHex(169, 169, 169) Darkkhaki = RGBHex(189, 183, 107) Darkmagenta = RGBHex(139, 0, 139) Darkolivegreen = RGBHex(85, 107, 47) Darkorange = RGBHex(255, 140, 0) Darkorchid = RGBHex(153, 50, 204) Darkred = RGBHex(139, 0, 0) Darksalmon = RGBHex(233, 150, 122) Darkseagreen = RGBHex(143, 188, 143) Darkslateblue = RGBHex(72, 61, 139) Darkslategray = RGBHex(47, 79, 79) Darkslategrey = RGBHex(47, 79, 79) Darkturquoise = RGBHex(0, 206, 209) Darkviolet = RGBHex(148, 0, 211) Deeppink = RGBHex(255, 20, 147) Deepskyblue = RGBHex(0, 191, 255) Dimgray = RGBHex(105, 105, 105) Dimgrey = RGBHex(105, 105, 105) Dodgerblue = RGBHex(30, 144, 255) Firebrick = RGBHex(178, 34, 34) Floralwhite = RGBHex(255, 250, 240) Forestgreen = RGBHex(34, 139, 34) Fuchsia = RGBHex(255, 0, 255) Gainsboro = RGBHex(220, 220, 220) Ghostwhite = RGBHex(248, 248, 255) Gold = RGBHex(255, 215, 0) Goldenrod = RGBHex(218, 165, 32) Gray = RGBHex(128, 128, 128) Green = RGBHex(0, 128, 0) Greenyellow = RGBHex(173, 255, 47) Honeydew = RGBHex(240, 255, 240) Hotpink = RGBHex(255, 105, 180) Indianred = RGBHex(205, 92, 92) Indigo = RGBHex(75, 0, 130) Ivory = RGBHex(255, 255, 240) Khaki = RGBHex(240, 230, 140) Lavender = RGBHex(230, 230, 250) Lavenderblush = RGBHex(255, 240, 245) Lawngreen = RGBHex(124, 252, 0) Lemonchiffon = RGBHex(255, 250, 205) Lightblue = RGBHex(173, 216, 230) Lightcoral = RGBHex(240, 128, 128) Lightcyan = RGBHex(224, 255, 255) Lightgoldenrodyellow = RGBHex(250, 250, 210) Lightgray = RGBHex(211, 211, 211) Lightgreen = RGBHex(144, 238, 144) Lightgrey = RGBHex(211, 211, 211) Lightpink = RGBHex(255, 182, 193) Lightsalmon = RGBHex(255, 160, 122) Lightseagreen = RGBHex(32, 178, 170) Lightskyblue = RGBHex(135, 206, 250) Lightslategray = RGBHex(119, 136, 153) Lightslategrey = RGBHex(119, 136, 153) Lightsteelblue = RGBHex(176, 196, 222) Lightyellow = RGBHex(255, 255, 224) Lime = RGBHex(0, 255, 0) Limegreen = RGBHex(50, 205, 50) Linen = RGBHex(250, 240, 230) Magenta = RGBHex(255, 0, 255) Maroon = RGBHex(128, 0, 0) Mediumaquamarine = RGBHex(102, 205, 170) Mediumblue = RGBHex(0, 0, 205) Mediumorchid = RGBHex(186, 85, 211) Mediumpurple = RGBHex(147, 112, 219) Mediumseagreen = RGBHex(60, 179, 113) Mediumslateblue = RGBHex(123, 104, 238) Mediumspringgreen = RGBHex(0, 250, 154) Mediumturquoise = RGBHex(72, 209, 204) Mediumvioletred = RGBHex(199, 21, 133) Midnightblue = RGBHex(25, 25, 112) Mintcream = RGBHex(245, 255, 250) Mistyrose = RGBHex(255, 228, 225) Moccasin = RGBHex(255, 228, 181) Oldlace = RGBHex(253, 245, 230) Olive = RGBHex(128, 128, 0) Olivedrab = RGBHex(107, 142, 35) Orange = RGBHex(255, 165, 0) Orangered = RGBHex(255, 69, 0) Orchid = RGBHex(218, 112, 214) Palegoldenrod = RGBHex(238, 232, 170) Palegreen = RGBHex(152, 251, 152) Paleturquoise = RGBHex(175, 238, 238) Palevioletred = RGBHex(219, 112, 147) Papayawhip = RGBHex(255, 239, 213) Peachpuff = RGBHex(255, 218, 185) Peru = RGBHex(205, 133, 63) Pink = RGBHex(255, 192, 203) Plum = RGBHex(221, 160, 221) Powderblue = RGBHex(176, 224, 230) Purple = RGBHex(128, 0, 128) Rebeccapurple = RGBHex(102, 51, 153) Red = RGBHex(255, 0, 0) Rosybrown = RGBHex(188, 143, 143) Royalblue = RGBHex(65, 105, 225) Saddlebrown = RGBHex(139, 69, 19) Salmon = RGBHex(250, 128, 114) Sandybrown = RGBHex(244, 164, 96) Seagreen = RGBHex(46, 139, 87) Seashell = RGBHex(255, 245, 238) Sienna = RGBHex(160, 82, 45) Silver = RGBHex(192, 192, 192) Skyblue = RGBHex(135, 206, 235) Slateblue = RGBHex(106, 90, 205) Slategray = RGBHex(112, 128, 144) Slategrey = RGBHex(112, 128, 144) Snow = RGBHex(255, 250, 250) Springgreen = RGBHex(0, 255, 127) Steelblue = RGBHex(70, 130, 180) Tan = RGBHex(210, 180, 140) Teal = RGBHex(0, 128, 128) Thistle = RGBHex(216, 191, 216) Tomato = RGBHex(255, 99, 71) Turquoise = RGBHex(64, 224, 208) Violet = RGBHex(238, 130, 238) Wheat = RGBHex(245, 222, 179) White = RGBHex(255, 255, 255) Whitesmoke = RGBHex(245, 245, 245) Yellow = RGBHex(255, 255, 0) Yellowgreen = RGBHex(154, 205, 50) )
Named color values
Functions ¶
This section is empty.
Types ¶
type Color ¶
Color holds rgba values for a color.
func Grey ¶
Grey creates a new Color struct with rgb all equal to the same value from 0.0 to 1.0 (a = 1.0).
func GreyHex ¶
GreyHex creates a new Color struct with rgb all equal to the same value from 0 to 255 (a = 1.0).
func HSL ¶
HSL creates a Color struct using hue (0.0 - 360.0), value (0.0 - 1.0) and lightness (0.0 - 1.0)
func HSLA ¶
HSLA creates a Color struct using hue (0.0 - 360.0), value (0.0 - 1.0), lightness (0.0 - 1.0), and alpha (0.0 - 1.0)
func HSV ¶
HSV creates a Color struct using hue (0.0 - 360.0), value (0.0 - 1.0) and value (0.0 - 1.0) (a = 1.0).
func HSVA ¶
HSVA creates a Color struct using hue (0.0 - 360.0), value (0.0 - 1.0), value (0.0 - 1.0) and alpha (0.0 - 1.0).
func NumberWithAlpha ¶
NumberWithAlpha creates a new Color struct with a 32-bit int 0xAARRGGBB.
func RandomGrey ¶
func RandomGrey() Color
RandomGrey creates a Color struct with a random grey shade from 0.0 to 1.0 (a = 1.0).
func RandomGreyRange ¶
RandomGreyRange creates a Color struct with a random grey shade from min to max (a = 1.0).
func RandomRGB ¶
func RandomRGB() Color
RandomRGB creates a color struct with random rgb values (a = 1.0).
func (Color) ColorDiffPercept ¶
ColorDiffPercept returns the euclidian distance between two colors.
func (Color) Contrast ¶
Contrast returns the contrast between this color and another color. ref: https://www.w3.org/TR/2012/NOTE-WCAG20-TECHS-20120103/G17.html
func (Color) Scale ¶
Scale scales the r, g, b channels by a percent. This will lighten or darken the color. Scale(1.05) will lighten the color by 5% of its current value. Scale(0.95) will darken the color by 5% of its current value. This is virtually the same as getting h, s, l and scaling the l But probably simpler in most cases.
type Palette ¶
type Palette struct {
// contains filtered or unexported fields
}
Palette is a list of colors.
func (*Palette) Reverse ¶
func (p *Palette) Reverse()
Reverse reverses the order of the colors in the palette.