color

package
v0.0.0-...-af996ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2019 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AliceBlue            = RGB(240, 248, 255)
	AntiqueWhite         = RGB(250, 235, 215)
	Aqua                 = RGB(0, 255, 255)
	Aquamarine           = RGB(127, 255, 212)
	Azure                = RGB(240, 255, 255)
	Beige                = RGB(245, 245, 220)
	Bisque               = RGB(255, 228, 196)
	Black                = RGB(0, 0, 0)
	BlanchedAlmond       = RGB(255, 235, 205)
	Blue                 = RGB(0, 0, 255)
	BlueViolet           = RGB(138, 43, 226)
	Brown                = RGB(165, 42, 42)
	BurlyWood            = RGB(222, 184, 135)
	CadetBlue            = RGB(95, 158, 160)
	Chartreuse           = RGB(127, 255, 0)
	Chocolate            = RGB(210, 105, 30)
	Coral                = RGB(255, 127, 80)
	CornflowerBlue       = RGB(100, 149, 237)
	Cornsilk             = RGB(255, 248, 220)
	Crimson              = RGB(220, 20, 60)
	Cyan                 = RGB(0, 255, 255)
	DarkBlue             = RGB(0, 0, 139)
	DarkCyan             = RGB(0, 139, 139)
	DarkGoldenRod        = RGB(184, 134, 11)
	DarkGray             = RGB(169, 169, 169)
	DarkGreen            = RGB(0, 100, 0)
	DarkGrey             = RGB(169, 169, 169)
	DarkKhaki            = RGB(189, 183, 107)
	DarkMagenta          = RGB(139, 0, 139)
	DarkOliveGreen       = RGB(85, 107, 47)
	DarkOrange           = RGB(255, 140, 0)
	DarkOrchid           = RGB(153, 50, 204)
	DarkRed              = RGB(139, 0, 0)
	DarkSalmon           = RGB(233, 150, 122)
	DarkSeaGreen         = RGB(143, 188, 143)
	DarkSlateBlue        = RGB(72, 61, 139)
	DarkSlateGray        = RGB(47, 79, 79)
	DarkSlateGrey        = RGB(47, 79, 79)
	DarkTurquoise        = RGB(0, 206, 209)
	DarkViolet           = RGB(148, 0, 211)
	DeepPink             = RGB(255, 20, 147)
	DeepSkyBlue          = RGB(0, 191, 255)
	DimGray              = RGB(105, 105, 105)
	DimGrey              = RGB(105, 105, 105)
	DodgerBlue           = RGB(30, 144, 255)
	FireBrick            = RGB(178, 34, 34)
	FloralWhite          = RGB(255, 250, 240)
	ForestGreen          = RGB(34, 139, 34)
	Fuchsia              = RGB(255, 0, 255)
	Gainsboro            = RGB(220, 220, 220)
	GhostWhite           = RGB(248, 248, 255)
	Gold                 = RGB(255, 215, 0)
	GoldenRod            = RGB(218, 165, 32)
	Gray                 = RGB(128, 128, 128)
	Green                = RGB(0, 128, 0)
	GreenYellow          = RGB(173, 255, 47)
	Grey                 = RGB(128, 128, 128)
	HoneyDew             = RGB(240, 255, 240)
	HotPink              = RGB(255, 105, 180)
	IndianRed            = RGB(205, 92, 92)
	Indigo               = RGB(75, 0, 130)
	Ivory                = RGB(255, 255, 240)
	Khaki                = RGB(240, 230, 140)
	Lavender             = RGB(230, 230, 250)
	LavenderBlush        = RGB(255, 240, 245)
	LawnGreen            = RGB(124, 252, 0)
	LemonChiffon         = RGB(255, 250, 205)
	LightBlue            = RGB(173, 216, 230)
	LightCoral           = RGB(240, 128, 128)
	LightCyan            = RGB(224, 255, 255)
	LightGoldenRodYellow = RGB(250, 250, 210)
	LightGray            = RGB(211, 211, 211)
	LightGreen           = RGB(144, 238, 144)
	LightGrey            = RGB(211, 211, 211)
	LightPink            = RGB(255, 182, 193)
	LightSalmon          = RGB(255, 160, 122)
	LightSeaGreen        = RGB(32, 178, 170)
	LightSkyBlue         = RGB(135, 206, 250)
	LightSlateGray       = RGB(119, 136, 153)
	LightSlateGrey       = RGB(119, 136, 153)
	LightSteelBlue       = RGB(176, 196, 222)
	LightYellow          = RGB(255, 255, 224)
	Lime                 = RGB(0, 255, 0)
	LimeGreen            = RGB(50, 205, 50)
	Linen                = RGB(250, 240, 230)
	Magenta              = RGB(255, 0, 255)
	Maroon               = RGB(128, 0, 0)
	MediumAquaMarine     = RGB(102, 205, 170)
	MediumBlue           = RGB(0, 0, 205)
	MediumOrchid         = RGB(186, 85, 211)
	MediumPurple         = RGB(147, 112, 219)
	MediumSeaGreen       = RGB(60, 179, 113)
	MediumSlateBlue      = RGB(123, 104, 238)
	MediumSpringGreen    = RGB(0, 250, 154)
	MediumTurquoise      = RGB(72, 209, 204)
	MediumVioletRed      = RGB(199, 21, 133)
	MidnightBlue         = RGB(25, 25, 112)
	MintCream            = RGB(245, 255, 250)
	MistyRose            = RGB(255, 228, 225)
	Moccasin             = RGB(255, 228, 181)
	NavajoWhite          = RGB(255, 222, 173)
	Navy                 = RGB(0, 0, 128)
	OldLace              = RGB(253, 245, 230)
	Olive                = RGB(128, 128, 0)
	OliveDrab            = RGB(107, 142, 35)
	Orange               = RGB(255, 165, 0)
	OrangeRed            = RGB(255, 69, 0)
	Orchid               = RGB(218, 112, 214)
	PaleGoldenRod        = RGB(238, 232, 170)
	PaleGreen            = RGB(152, 251, 152)
	PaleTurquoise        = RGB(175, 238, 238)
	PaleVioletRed        = RGB(219, 112, 147)
	PapayaWhip           = RGB(255, 239, 213)
	PeachPuff            = RGB(255, 218, 185)
	Peru                 = RGB(205, 133, 63)
	Pink                 = RGB(255, 192, 203)
	Plum                 = RGB(221, 160, 221)
	PowderBlue           = RGB(176, 224, 230)
	Purple               = RGB(128, 0, 128)
	Red                  = RGB(255, 0, 0)
	RosyBrown            = RGB(188, 143, 143)
	RoyalBlue            = RGB(65, 105, 225)
	SaddleBrown          = RGB(139, 69, 19)
	Salmon               = RGB(250, 128, 114)
	SandyBrown           = RGB(244, 164, 96)
	SeaGreen             = RGB(46, 139, 87)
	SeaShell             = RGB(255, 245, 238)
	Sienna               = RGB(160, 82, 45)
	Silver               = RGB(192, 192, 192)
	SkyBlue              = RGB(135, 206, 235)
	SlateBlue            = RGB(106, 90, 205)
	SlateGray            = RGB(112, 128, 144)
	SlateGrey            = RGB(112, 128, 144)
	Snow                 = RGB(255, 250, 250)
	SpringGreen          = RGB(0, 255, 127)
	SteelBlue            = RGB(70, 130, 180)
	Tan                  = RGB(210, 180, 140)
	Teal                 = RGB(0, 128, 128)
	Thistle              = RGB(216, 191, 216)
	Tomato               = RGB(255, 99, 71)
	Turquoise            = RGB(64, 224, 208)
	Violet               = RGB(238, 130, 238)
	Wheat                = RGB(245, 222, 179)
	White                = RGB(255, 255, 255)
	WhiteSmoke           = RGB(245, 245, 245)
	Yellow               = RGB(255, 255, 0)
	YellowGreen          = RGB(154, 205, 50)
)

CSS named colors.

View Source
var (
	// Background is the system color used for the window background.
	Background = RGB(236, 236, 236)
	// KeyboardFocus is the system color used to highlight controls that have the keyboard focus.
	KeyboardFocus = RGB(59, 153, 252)
	// SelectedTextBackground is the system color used for the background of selected text.
	SelectedTextBackground = RGB(178, 215, 255)
	// SelectedText is the system color used for selected text.
	SelectedText = White
	// TextBackground is the system color used for the background of editable text areas.
	TextBackground = White
	// Text is the system color used for the text in editable text areas.
	Text = Black
)

Functions

This section is empty.

Types

type Color

type Color uint32

Color contains the value of a color used for drawing, stored as 0xAARRGGBB.

func Decode

func Decode(buffer string) Color

Decode creates a Color from a string. The string may be in any of the standard CSS formats:

- CSS predefined color name, e.g. "Yellow" - CSS rgb(), e.g. "rgb(255, 255, 0)" - CSS rgba(), e.g. "rgba(255, 255, 0, 0.3)" - CSS short hexadecimal colors, e.g. "#FF0" - CSS long hexadecimal colors, e.g. "#FFFF00" - CCS hsl(), e.g. "hsl(120, 100%, 50%)" - CSS hsla(), e.g. "hsla(120, 100%, 50%, 0.3)"

func HSB

func HSB(hue, saturation, brightness float64) Color

HSB creates a new opaque Color from HSB values in the range 0-1.

func HSBA

func HSBA(hue, saturation, brightness, alpha float64) Color

HSBA creates a new Color from HSBA values in the range 0-1.

func RGB

func RGB(red, green, blue int) Color

RGB creates a new opaque Color from RGB values in the range 0-255.

func RGBA

func RGBA(red, green, blue int, alpha float64) Color

RGBA creates a new Color from RGB values in the range 0-255 and an alpha value in the range 0-1.

func RGBAfloat

func RGBAfloat(red, green, blue, alpha float64) Color

RGBAfloat creates a new Color from RGBA values in the range 0-1.

func (Color) AdjustBrightness

func (c Color) AdjustBrightness(amount float64) Color

AdjustBrightness creates a new color from this color with its brightness adjusted by the specified amount.

func (Color) AdjustHue

func (c Color) AdjustHue(amount float64) Color

AdjustHue creates a new color from this color with its hue adjusted by the specified amount.

func (Color) AdjustSaturation

func (c Color) AdjustSaturation(amount float64) Color

AdjustSaturation creates a new color from this color with its saturation adjusted by the specified amount.

func (Color) Alpha

func (c Color) Alpha() int

Alpha returns the alpha channel, in the range of 0-255.

func (Color) AlphaIntensity

func (c Color) AlphaIntensity() float64

AlphaIntensity returns the alpha channel, in the range of 0-1.

func (Color) Blend

func (c Color) Blend(other Color, pct float64) Color

Blend blends this color with another color. pct is the amount of the other color to use.

func (Color) Blue

func (c Color) Blue() int

Blue returns the blue channel, in the range of 0-255.

func (Color) BlueIntensity

func (c Color) BlueIntensity() float64

BlueIntensity returns the blue channel, in the range of 0-1.

func (Color) Brightness

func (c Color) Brightness() float64

Brightness of the color, a value from 0-1.

func (Color) Green

func (c Color) Green() int

Green returns the green channel, in the range of 0-255.

func (Color) GreenIntensity

func (c Color) GreenIntensity() float64

GreenIntensity returns the green channel, in the range of 0-1.

func (Color) HSB

func (c Color) HSB() (hue, saturation, brightness float64)

HSB returns the hue, saturation and brightness of the color. Values are in the range 0-1.

func (Color) HasAlpha

func (c Color) HasAlpha() bool

HasAlpha returns true if the color is not fully opaque.

func (Color) Hue

func (c Color) Hue() float64

Hue of the color, a value from 0-1.

func (Color) Invisible

func (c Color) Invisible() bool

Invisible returns true if the color is fully transparent.

func (Color) Luminance

func (c Color) Luminance() float64

Luminance returns a value from 0-1 representing the perceived brightness. Lower values represent darker colors, while higher values represent brighter colors.

func (Color) Monochrome

func (c Color) Monochrome() bool

Monochrome returns true if each color component is the same, making it a shade of gray.

func (Color) Opaque

func (c Color) Opaque() bool

Opaque returns true if the color is fully opaque.

func (Color) Premultiply

func (c Color) Premultiply() Color

Premultiply multiplies the color channels by the alpha channel.

func (Color) Red

func (c Color) Red() int

Red returns the red channel, in the range of 0-255.

func (Color) RedIntensity

func (c Color) RedIntensity() float64

RedIntensity returns the red channel, in the range of 0-1.

func (Color) Saturation

func (c Color) Saturation() float64

Saturation of the color, a value from 0-1.

func (Color) SetAlpha

func (c Color) SetAlpha(alpha int) Color

SetAlpha returns a new color based on this color, but with the alpha channel replaced.

func (Color) SetAlphaIntensity

func (c Color) SetAlphaIntensity(alpha float64) Color

SetAlphaIntensity returns a new color based on this color, but with the alpha channel replaced.

func (Color) SetBlue

func (c Color) SetBlue(blue int) Color

SetBlue returns a new color based on this color, but with the blue channel replaced.

func (Color) SetBlueIntensity

func (c Color) SetBlueIntensity(blue float64) Color

SetBlueIntensity returns a new color based on this color, but with the blue channel replaced.

func (Color) SetBrightness

func (c Color) SetBrightness(brightness float64) Color

SetBrightness creates a new color from this color with the specified brightness.

func (Color) SetGreen

func (c Color) SetGreen(green int) Color

SetGreen returns a new color based on this color, but with the green channel replaced.

func (Color) SetGreenIntensity

func (c Color) SetGreenIntensity(green float64) Color

SetGreenIntensity returns a new color based on this color, but with the green channel replaced.

func (Color) SetHue

func (c Color) SetHue(hue float64) Color

SetHue creates a new color from this color with the specified hue, a value from 0-1.

func (Color) SetRed

func (c Color) SetRed(red int) Color

SetRed returns a new color based on this color, but with the red channel replaced.

func (Color) SetRedIntensity

func (c Color) SetRedIntensity(red float64) Color

SetRedIntensity returns a new color based on this color, but with the red channel replaced.

func (Color) SetSaturation

func (c Color) SetSaturation(saturation float64) Color

SetSaturation creates a new color from this color with the specified saturation.

func (Color) String

func (c Color) String() string

String implements the fmt.Stringer interface. The output can be used as a color in CSS.

func (Color) Unpremultiply

func (c Color) Unpremultiply() Color

Unpremultiply divides the color channels by the alpha channel, effectively undoing a Premultiply call. Note that you will not necessarily get the original value back after calling Premultiply followed by Unpremultiply.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL