I'd love to see the various color functions use tables/arrays in addition to discrete values so that we could treat Color as an atomic value when appropriate. Discrete values are great when you want to perform calculations on the color but this is a fairly rare occurance (except for the alpha channel, obviously). If you add a default table of colors (perhaps the HTML/CSS named colors) whose values could be passed by reference through the API you would would have a win/win in terms of both legibility and memory efficiency.
In code, the useage would change from this:
myFrame:SetBackgroundColor(0.65,0.16,0.16)
to this:
myFrame:SetBackgroundColor(Color.brown)
I envision combining the RGB values into a table but keeping the alpha separate for easy fade in/fade out animation. This would be in addition to the existing Setter that accepts discrete values. Something like this:
SetBackgroundColorSets the background color of this frame.
Frame:SetBackgroundColor(c) -- table
Frame:SetBackgroundColor(c, a) -- table, number
Parameters:c: Color {b: Blue.}
g: Green.
r: Red.
a: Alpha. 1 is fully opaque, 0 is fully transparent. Defaults to 1.
For the Getter function it is less important that we return references to the default table since the typical use case is to re-use the color for another frame and not to compare the return value to that of another frame. Returning color as a table might look something like this:
GetBackgroundColorRetrieves the background color of this frame.c, a = Frame:GetBackgroundColor() -- table, number <- voidResults:c:{a: Alpha. 1 is fully opaque, 0 is fully transparent.b: Blue.}
g: Green.
r: Red.
The constant table might look something like this if we chose to base it on the HTML/CSS standard named colors:
Color = {AliceBlue={0.94,0.97,1.00},}
AntiqueWhite={0.98,0.92,0.84},
Aqua={0,1.00,1.00},
Aquamarine={0.50,1.00,0.83},
Azure={0.94,1.00,1.00},
Beige={0.96,0.96,0.86},
Bisque={1.00,0.89,0.77},
Black={0,0,0},
BlanchedAlmond={1.00,0.92,0.80},
Blue={0,0,1.00},
BlueViolet={0.54,0.17,0.89},
Brown={0.65,0.16,0.16},
BurlyWood={0.87,0.72,0.53},
CadetBlue={0.37,0.62,0.63},
Chartreuse={0.50,1.00,0},
Chocolate={0.82,0.41,0.12},
Coral={1.00,0.50,0.31},
CornflowerBlue={0.39,0.58,0.93},
Cornsilk={1.00,0.97,0.86},
Crimson={0.86,0.08,0.24},
Cyan={0,1.00,1.00},
DarkBlue={0,0,0.55},
DarkCyan={0,0.55,0.55},
DarkGoldenRod={0.72,0.53,0.04},
DarkGray={0.66,0.66,0.66},
DarkGrey={0.66,0.66,0.66},
DarkGreen={0,0.39,0},
DarkKhaki={0.74,0.72,0.42},
DarkMagenta={0.55,0,0.55},
DarkOliveGreen={0.33,0.42,0.18},
Darkorange={1.00,0.55,0},
DarkOrchid={0.60,0.20,0.80},
DarkRed={0.55,0,0},
DarkSalmon={0.91,0.59,0.48},
DarkSeaGreen={0.56,0.74,0.56},
DarkSlateBlue={0.28,0.24,0.55},
DarkSlateGray={0.18,0.31,0.31},
DarkSlateGrey={0.18,0.31,0.31},
DarkTurquoise={0,0.81,0.82},
DarkViolet={0.58,0,0.83},
DeepPink={1.00,0.08,0.58},
DeepSkyBlue={0,0.75,1.00},
DimGray={0.41,0.41,0.41},
DimGrey={0.41,0.41,0.41},
DodgerBlue={0.12,0.56,1.00},
FireBrick={0.70,0.13,0.13},
FloralWhite={1.00,0.98,0.94},
ForestGreen={0.13,0.55,0.13},
Fuchsia={1.00,0,1.00},
Gainsboro={0.86,0.86,0.86},
GhostWhite={0.97,0.97,1.00},
Gold={1.00,0.84,0},
GoldenRod={0.85,0.65,0.13},
Gray={0.50,0.50,0.50},
Grey={0.50,0.50,0.50},
Green={0,0.50,0},
GreenYellow={0.68,1.00,0.18},
HoneyDew={0.94,1.00,0.94},
HotPink={1.00,0.41,0.71},
IndianRed={0.80,0.36,0.36},
Indigo={0.29,0,0.51},
Ivory={1.00,1.00,0.94},
Khaki={0.94,0.90,0.55},
Lavender={0.90,0.90,0.98},
LavenderBlush={1.00,0.94,0.96},
LawnGreen={0.49,0.99,0},
LemonChiffon={1.00,0.98,0.80},
LightBlue={0.68,0.85,0.90},
LightCoral={0.94,0.50,0.50},
LightCyan={0.88,1.00,1.00},
LightGoldenRodYellow={0.98,0.98,0.82},
LightGray={0.83,0.83,0.83},
LightGrey={0.83,0.83,0.83},
LightGreen={0.56,0.93,0.56},
LightPink={1.00,0.71,0.76},
LightSalmon={1.00,0.63,0.48},
LightSeaGreen={0.13,0.70,0.67},
LightSkyBlue={0.53,0.81,0.98},
LightSlateGray={0.47,0.53,0.60},
LightSlateGrey={0.47,0.53,0.60},
LightSteelBlue={0.69,0.77,0.87},
LightYellow={1.00,1.00,0.88},
Lime={0,1.00,0},
LimeGreen={0.20,0.80,0.20},
Linen={0.98,0.94,0.90},
Magenta={1.00,0,1.00},
Maroon={0.50,0,0},
MediumAquaMarine={0.40,0.80,0.67},
MediumBlue={0,0,0.80},
MediumOrchid={0.73,0.33,0.83},
MediumPurple={0.58,0.44,0.85},
MediumSeaGreen={0.24,0.70,0.44},
MediumSlateBlue={0.48,0.41,0.93},
MediumSpringGreen={0,0.98,0.60},
MediumTurquoise={0.28,0.82,0.80},
MediumVioletRed={0.78,0.08,0.52},
MidnightBlue={0.10,0.10,0.44},
MintCream={0.96,1.00,0.98},
MistyRose={1.00,0.89,0.88},
Moccasin={1.00,0.89,0.71},
NavajoWhite={1.00,0.87,0.68},
Navy={0,0,0.50},
OldLace={0.99,0.96,0.90},
Olive={0.50,0.50,0},
OliveDrab={0.42,0.56,0.14},
Orange={1.00,0.65,0},
OrangeRed={1.00,0.27,0},
Orchid={0.85,0.44,0.84},
PaleGoldenRod={0.93,0.91,0.67},
PaleGreen={0.60,0.98,0.60},
PaleTurquoise={0.69,0.93,0.93},
PaleVioletRed={0.85,0.44,0.58},
PapayaWhip={1.00,0.94,0.84},
PeachPuff={1.00,0.85,0.73},
Peru={0.80,0.52,0.25},
Pink={1.00,0.75,0.80},
Plum={0.87,0.63,0.87},
PowderBlue={0.69,0.88,0.90},
Purple={0.50,0,0.50},
Red={1.00,0,0},
RosyBrown={0.74,0.56,0.56},
RoyalBlue={0.25,0.41,0.88},
SaddleBrown={0.55,0.27,0.07},
Salmon={0.98,0.50,0.45},
SandyBrown={0.96,0.64,0.38},
SeaGreen={0.18,0.55,0.34},
SeaShell={1.00,0.96,0.93},
Sienna={0.63,0.32,0.18},
Silver={0.75,0.75,0.75},
SkyBlue={0.53,0.81,0.92},
SlateBlue={0.42,0.35,0.80},
SlateGray={0.44,0.50,0.56},
SlateGrey={0.44,0.50,0.56},
Snow={1.00,0.98,0.98},
SpringGreen={0,1.00,0.50},
SteelBlue={0.27,0.51,0.71},
Tan={0.82,0.71,0.55},
Teal={0,0.50,0.50},
Thistle={0.85,0.75,0.85},
Tomato={1.00,0.39,0.28},
Turquoise={0.25,0.88,0.82},
Violet={0.93,0.51,0.93},
Wheat={0.96,0.87,0.70},
White={1.00,1.00,1.00},
WhiteSmoke={0.96,0.96,0.96},
Yellow={1.00,1.00,0},
YellowGreen={0.60,0.80,0.20},


Reply With Quote

Bookmarks