Documentation ¶
Index ¶
- Variables
- type ColorGroup
- type ColorMixType
- type LedColor
- func (c LedColor) Alpha(a float64) LedColor
- func (c LedColor) Bright(t float64) LedColor
- func (c LedColor) Dark(t float64) LedColor
- func (c LedColor) HSL() (h, s, l float64)
- func (c1 LedColor) Interpolate(c2 LedColor, t float64) LedColor
- func (c LedColor) Mix(bg LedColor, mix ColorMixType) LedColor
- func (c LedColor) RGB() (r, g, b uint8)
- func (c LedColor) RGBA() (r, g, b, a uint32)
- func (c LedColor) String() string
- func (c *LedColor) UnmarshalText(text []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( AliceBlue = LedColor{0xF0, 0xF8, 0xFF, 0xFF} AntiqueWhite = LedColor{0xFA, 0xEB, 0xD7, 0xFF} Aqua = LedColor{0x00, 0xFF, 0xFF, 0xFF} Aquamarine = LedColor{0x7F, 0xFF, 0xD4, 0xFF} Azure = LedColor{0xF0, 0xFF, 0xFF, 0xFF} Beige = LedColor{0xF5, 0xF5, 0xDC, 0xFF} Bisque = LedColor{0xFF, 0xE4, 0xC4, 0xFF} Black = LedColor{0x00, 0x00, 0x00, 0xFF} BlanchedAlmond = LedColor{0xFF, 0xEB, 0xCD, 0xFF} Blue = LedColor{0x00, 0x00, 0xFF, 0xFF} BlueViolet = LedColor{0x8A, 0x2B, 0xE2, 0xFF} Brown = LedColor{0xA5, 0x2A, 0x2A, 0xFF} BurlyWood = LedColor{0xDE, 0xB8, 0x87, 0xFF} CadetBlue = LedColor{0x5F, 0x9E, 0xA0, 0xFF} Chartreuse = LedColor{0x7F, 0xFF, 0x00, 0xFF} Chocolate = LedColor{0xD2, 0x69, 0x1E, 0xFF} Coral = LedColor{0xFF, 0x7F, 0x50, 0xFF} CornflowerBlue = LedColor{0x64, 0x95, 0xED, 0xFF} Cornsilk = LedColor{0xFF, 0xF8, 0xDC, 0xFF} Crimson = LedColor{0xDC, 0x14, 0x3C, 0xFF} Cyan = LedColor{0x00, 0xFF, 0xFF, 0xFF} DarkBlue = LedColor{0x00, 0x00, 0x8B, 0xFF} DarkCyan = LedColor{0x00, 0x8B, 0x8B, 0xFF} DarkGoldenrod = LedColor{0xB8, 0x86, 0x0B, 0xFF} DarkGray = LedColor{0xA9, 0xA9, 0xA9, 0xFF} DarkGreen = LedColor{0x00, 0x64, 0x00, 0xFF} DarkGrey = LedColor{0xA9, 0xA9, 0xA9, 0xFF} DarkKhaki = LedColor{0xBD, 0xB7, 0x6B, 0xFF} DarkMagenta = LedColor{0x8B, 0x00, 0x8B, 0xFF} DarkOliveGreen = LedColor{0x55, 0x6B, 0x2F, 0xFF} DarkOrange = LedColor{0xFF, 0x8C, 0x00, 0xFF} DarkOrchid = LedColor{0x99, 0x32, 0xCC, 0xFF} DarkRed = LedColor{0x8B, 0x00, 0x00, 0xFF} DarkSalmon = LedColor{0xE9, 0x96, 0x7A, 0xFF} DarkSeaGreen = LedColor{0x8F, 0xBC, 0x8F, 0xFF} DarkSlateBlue = LedColor{0x48, 0x3D, 0x8B, 0xFF} DarkSlateGray = LedColor{0x2F, 0x4F, 0x4F, 0xFF} DarkSlateGrey = LedColor{0x2F, 0x4F, 0x4F, 0xFF} DarkTurquoise = LedColor{0x00, 0xCE, 0xD1, 0xFF} DarkViolet = LedColor{0x94, 0x00, 0xD3, 0xFF} DeepPink = LedColor{0xFF, 0x14, 0x93, 0xFF} DeepSkyBlue = LedColor{0x00, 0xBF, 0xFF, 0xFF} DimGray = LedColor{0x69, 0x69, 0x69, 0xFF} DimGrey = LedColor{0x69, 0x69, 0x69, 0xFF} DodgerBlue = LedColor{0x1E, 0x90, 0xFF, 0xFF} FireBrick = LedColor{0xB2, 0x22, 0x22, 0xFF} FloralWhite = LedColor{0xFF, 0xFA, 0xF0, 0xFF} ForestGreen = LedColor{0x22, 0x8B, 0x22, 0xFF} Fuchsia = LedColor{0xFF, 0x00, 0xFF, 0xFF} Gainsboro = LedColor{0xDC, 0xDC, 0xDC, 0xFF} GhostWhite = LedColor{0xF8, 0xF8, 0xFF, 0xFF} Gold = LedColor{0xFF, 0xD7, 0x00, 0xFF} Goldenrod = LedColor{0xDA, 0xA5, 0x20, 0xFF} Gray = LedColor{0x80, 0x80, 0x80, 0xFF} Green = LedColor{0x00, 0x80, 0x00, 0xFF} GreenYellow = LedColor{0xAD, 0xFF, 0x2F, 0xFF} Grey = LedColor{0x80, 0x80, 0x80, 0xFF} Honeydew = LedColor{0xF0, 0xFF, 0xF0, 0xFF} HotPink = LedColor{0xFF, 0x69, 0xB4, 0xFF} IndianRed = LedColor{0xCD, 0x5C, 0x5C, 0xFF} Indigo = LedColor{0x4B, 0x00, 0x82, 0xFF} Ivory = LedColor{0xFF, 0xFF, 0xF0, 0xFF} Khaki = LedColor{0xF0, 0xE6, 0x8C, 0xFF} Lavender = LedColor{0xE6, 0xE6, 0xFA, 0xFF} LavenderBlush = LedColor{0xFF, 0xF0, 0xF5, 0xFF} LawnGreen = LedColor{0x7C, 0xFC, 0x00, 0xFF} LemonChiffon = LedColor{0xFF, 0xFA, 0xCD, 0xFF} LightBlue = LedColor{0xAD, 0xD8, 0xE6, 0xFF} LightCoral = LedColor{0xF0, 0x80, 0x80, 0xFF} LightCyan = LedColor{0xE0, 0xFF, 0xFF, 0xFF} LightGoldenrodYellow = LedColor{0xFA, 0xFA, 0xD2, 0xFF} LightGray = LedColor{0xD3, 0xD3, 0xD3, 0xFF} LightGreen = LedColor{0x90, 0xEE, 0x90, 0xFF} LightGrey = LedColor{0xD3, 0xD3, 0xD3, 0xFF} LightPink = LedColor{0xFF, 0xB6, 0xC1, 0xFF} LightSalmon = LedColor{0xFF, 0xA0, 0x7A, 0xFF} LightSeaGreen = LedColor{0x20, 0xB2, 0xAA, 0xFF} LightSkyBlue = LedColor{0x87, 0xCE, 0xFA, 0xFF} LightSlateGray = LedColor{0x77, 0x88, 0x99, 0xFF} LightSlateGrey = LedColor{0x77, 0x88, 0x99, 0xFF} LightSteelBlue = LedColor{0xB0, 0xC4, 0xDE, 0xFF} LightYellow = LedColor{0xFF, 0xFF, 0xE0, 0xFF} Lime = LedColor{0x00, 0xFF, 0x00, 0xFF} LimeGreen = LedColor{0x32, 0xCD, 0x32, 0xFF} Linen = LedColor{0xFA, 0xF0, 0xE6, 0xFF} Magenta = LedColor{0xFF, 0x00, 0xFF, 0xFF} Maroon = LedColor{0x80, 0x00, 0x00, 0xFF} MediumAquamarine = LedColor{0x66, 0xCD, 0xAA, 0xFF} MediumBlue = LedColor{0x00, 0x00, 0xCD, 0xFF} MediumOrchid = LedColor{0xBA, 0x55, 0xD3, 0xFF} MediumPurple = LedColor{0x93, 0x70, 0xDB, 0xFF} MediumSeaGreen = LedColor{0x3C, 0xB3, 0x71, 0xFF} MediumSlateBlue = LedColor{0x7B, 0x68, 0xEE, 0xFF} MediumSpringGreen = LedColor{0x00, 0xFA, 0x9A, 0xFF} MediumTurquoise = LedColor{0x48, 0xD1, 0xCC, 0xFF} MediumVioletRed = LedColor{0xC7, 0x15, 0x85, 0xFF} MidnightBlue = LedColor{0x19, 0x19, 0x70, 0xFF} MintCream = LedColor{0xF5, 0xFF, 0xFA, 0xFF} MistyRose = LedColor{0xFF, 0xE4, 0xE1, 0xFF} Moccasin = LedColor{0xFF, 0xE4, 0xB5, 0xFF} OldLace = LedColor{0xFD, 0xF5, 0xE6, 0xFF} Olive = LedColor{0x80, 0x80, 0x00, 0xFF} OliveDrab = LedColor{0x6B, 0x8E, 0x23, 0xFF} Orange = LedColor{0xFF, 0xA5, 0x00, 0xFF} OrangeRed = LedColor{0xFF, 0x45, 0x00, 0xFF} Orchid = LedColor{0xDA, 0x70, 0xD6, 0xFF} PaleGoldenrod = LedColor{0xEE, 0xE8, 0xAA, 0xFF} PaleGreen = LedColor{0x98, 0xFB, 0x98, 0xFF} PaleTurquoise = LedColor{0xAF, 0xEE, 0xEE, 0xFF} PaleVioletRed = LedColor{0xDB, 0x70, 0x93, 0xFF} PapayaWhip = LedColor{0xFF, 0xEF, 0xD5, 0xFF} PeachPuff = LedColor{0xFF, 0xDA, 0xB9, 0xFF} Peru = LedColor{0xCD, 0x85, 0x3F, 0xFF} Pink = LedColor{0xFF, 0xC0, 0xCB, 0xFF} Plum = LedColor{0xDD, 0xA0, 0xDD, 0xFF} PowderBlue = LedColor{0xB0, 0xE0, 0xE6, 0xFF} Purple = LedColor{0x80, 0x00, 0x80, 0xFF} Red = LedColor{0xFF, 0x00, 0x00, 0xFF} RosyBrown = LedColor{0xBC, 0x8F, 0x8F, 0xFF} RoyalBlue = LedColor{0x41, 0x69, 0xE1, 0xFF} SaddleBrown = LedColor{0x8B, 0x45, 0x13, 0xFF} Salmon = LedColor{0xFA, 0x80, 0x72, 0xFF} SandyBrown = LedColor{0xF4, 0xA4, 0x60, 0xFF} SeaGreen = LedColor{0x2E, 0x8B, 0x57, 0xFF} Seashell = LedColor{0xFF, 0xF5, 0xEE, 0xFF} Sienna = LedColor{0xA0, 0x52, 0x2D, 0xFF} Silver = LedColor{0xC0, 0xC0, 0xC0, 0xFF} SkyBlue = LedColor{0x87, 0xCE, 0xEB, 0xFF} SlateBlue = LedColor{0x6A, 0x5A, 0xCD, 0xFF} SlateGray = LedColor{0x70, 0x80, 0x90, 0xFF} SlateGrey = LedColor{0x70, 0x80, 0x90, 0xFF} Snow = LedColor{0xFF, 0xFA, 0xFA, 0xFF} SpringGreen = LedColor{0x00, 0xFF, 0x7F, 0xFF} SteelBlue = LedColor{0x46, 0x82, 0xB4, 0xFF} Tan = LedColor{0xD2, 0xB4, 0x8C, 0xFF} Teal = LedColor{0x00, 0x80, 0x80, 0xFF} Thistle = LedColor{0xD8, 0xBF, 0xD8, 0xFF} Tomato = LedColor{0xFF, 0x63, 0x47, 0xFF} Turquoise = LedColor{0x40, 0xE0, 0xD0, 0xFF} Violet = LedColor{0xEE, 0x82, 0xEE, 0xFF} Wheat = LedColor{0xF5, 0xDE, 0xB3, 0xFF} White = LedColor{0xFF, 0xFF, 0xFF, 0xFF} WhiteSmoke = LedColor{0xF5, 0xF5, 0xF5, 0xFF} Yellow = LedColor{0xFF, 0xFF, 0x00, 0xFF} YellowGreen = LedColor{0x9A, 0xCD, 0x32, 0xFF} Map = map[string]LedColor{}/* 147 elements not displayed */ Names = []string{}/* 147 elements not displayed */ )
var Groups = map[ColorGroup][]string{ Browns: { "Cornsilk", "BlanchedAlmond", "Bisque", "NavajoWhite", "Wheat", "BurlyWood", "Tan", "RosyBrown", "SandyBrown", "Goldenrod", "DarkGoldenrod", "Peru", "Chocolate", "SaddleBrown", "Sienna", "Brown", "Maroon", }, Reds: { "IndianRed", "LightCoral", "Salmon", "DarkSalmon", "LightSalmon", "Red", "Crimson", "FireBrick", "DarkRed", }, Oranges: { "LightSalmon", "Coral", "Tomato", "OrangeRed", "DarkOrange", "Orange", }, Yellows: { "Gold", "Yellow", "LightYellow", "LemonChiffon", "LightGoldenrodYellow", "PapayaWhip", "Moccasin", "PeachPuff", "PaleGoldenrod", "Khaki", "DarkKhaki", }, Greens: { "GreenYellow", "Chartreuse", "LawnGreen", "Lime", "LimeGreen", "PaleGreen", "LightGreen", "MediumSpringGreen", "SpringGreen", "MediumSeaGreen", "SeaGreen", "ForestGreen", "Green", "DarkGreen", "YellowGreen", "OliveDrab", "Olive", "DarkOliveGreen", "MediumAquamarine", "DarkSeaGreen", "LightSeaGreen", "DarkCyan", "Teal", }, Blues: { "Aqua", "Cyan", "LightCyan", "PaleTurquoise", "Aquamarine", "Turquoise", "MediumTurquoise", "DarkTurquoise", "CadetBlue", "SteelBlue", "LightSteelBlue", "PowderBlue", "LightBlue", "SkyBlue", "LightSkyBlue", "DeepSkyBlue", "DodgerBlue", "CornflowerBlue", "RoyalBlue", "Blue", "MediumBlue", "DarkBlue", "Navy", "MidnightBlue", }, Purples: { "Lavender", "Thistle", "Plum", "Violet", "Orchid", "Fuchsia", "Magenta", "MediumOrchid", "MediumPurple", "BlueViolet", "DarkViolet", "DarkOrchid", "DarkMagenta", "Purple", "Indigo", "DarkSlateBlue", "SlateBlue", "MediumSlateBlue", }, Pinks: { "Pink", "LightPink", "HotPink", "DeepPink", "MediumVioletRed", "PaleVioletRed", }, Whites: { "White", "Snow", "Honeydew", "MintCream", "Azure", "AliceBlue", "GhostWhite", "WhiteSmoke", "Seashell", "Beige", "OldLace", "FloralWhite", "Ivory", "AntiqueWhite", "Linen", "LavenderBlush", "MistyRose", }, Grays: { "Gainsboro", "LightGray", "Silver", "DarkGray", "Gray", "DimGray", "LightSlateGray", "SlateGray", "DarkSlateGray", "Black", }, }
In diesem File werden die Farben aus colornames.go nach Farbton in verschiedene Gruppen unterteilt.
var (
LedColorModel color.Model = color.ModelFunc(ledColorModel)
)
Das zum Typ LedColor zugehoerende ColorModel.
var (
Transparent = NewLedColorRGBA(0x00, 0x00, 0x00, 0x00)
)
Functions ¶
This section is empty.
Types ¶
type ColorGroup ¶
type ColorGroup int
const ( Purples ColorGroup = iota Pinks Blues Reds Greens Oranges Yellows Browns Whites Grays NumColorGroups )
func (*ColorGroup) Set ¶
func (g *ColorGroup) Set(str string) error
func (ColorGroup) String ¶
func (g ColorGroup) String() string
type ColorMixType ¶
type ColorMixType int
Mit folgenden Konstanten kann das Verfahren bestimmt werden, welches beim Mischen von Farben verwendet werden soll (siehe auch Methode Mix).
const ( // Ersetzt die Hintergundfarbe durch die Vordergrundfarbe. Replace ColorMixType = iota // Ueberblendet die Hintergrundfarbe mit der Vordergrundfarbe anhand // des Alpha-Wertes. Blend // Bestimmt die neue Farbe durch das Maximum von RGB zwischen Hinter- und // Vordergrundfarbe. Max // Analog zu Max, nimmt jedoch den Mittelwert von jeweils R, G und B. Average // Analog zu Max, nimmt jedoch das Minimum von jeweils R, G und B. Min )
type LedColor ¶
type LedColor struct {
R, G, B, A uint8
}
Dieser Typ wird fuer die Farbwerte verwendet, welche via SPI zu den LED's gesendet werden. Die Daten sind _nicht_ gamma-korrigiert, dies wird erst auf dem Panel-Empfaenger gemacht (pixelcontroller-slave). LedColor implementiert das color.Color Interface.
func NewLedColorHex ¶ added in v1.4.1
func NewLedColorHexA ¶ added in v1.4.1
func NewLedColorRGB ¶ added in v1.4.1
func NewLedColorRGBA ¶ added in v1.4.1
func RandColor ¶
func RandColor() LedColor
Mit RandColor kann zufällig eine aus dem gesamten Sortiment der hier definierten Farben gewählt werden. Hilfreich für Tests, Beispielprogramme oder anderes.
func RandGroupColor ¶
func RandGroupColor(group ColorGroup) LedColor
Mit RandGroupColor kann der Zufall eine bestimmte Farbgruppe beschraenkt werden.
func (LedColor) Interpolate ¶
Berechnet eine RGB-Farbe, welche 'zwischen' den Farben c1 und c2 liegt, so dass bei t=0 der Farbwert c1 und bei t=1 der Farbwert c2 retourniert wird. t wird vorgaengig auf das Interval [0,1] eingeschraenkt.
func (LedColor) Mix ¶
func (c LedColor) Mix(bg LedColor, mix ColorMixType) LedColor
Mischt die Farben c (Vordergrundfarbe) und bg (Hintergrundfarbe) nach einem Verfahren, welches in typ spezifiziert ist. Aktuell stehen 'Blend' (Ueber- blendung von bg durch c anhand des Alpha-Wertes von c) und 'Add' (nimm jeweils das Maximum pro Farbwert von c und bg) zur Verfuegung.