Difference between revisions of "TControl.Color"

From OpenEUO
Jump to: navigation, search
(Created page with " '''RW Color : n''' Specifies the background color of the control. Use Color to read or change the background color of the control.")
 
(added colors from gui/const.lua and color generating function)
 
Line 3: Line 3:
 
  Specifies the background color of the control.
 
  Specifies the background color of the control.
  
Use Color to read or change the background color of the control.
+
Use Color to read or change the background color of the control. Colors are specified by number, the underlying 32-bit BGR color format is the same as for the Delphi TColor type, with some special values assigned when the most significant byte value is 0xFF:
 +
 
 +
local function H(s)
 +
  return tonumber(s,16)
 +
end
 +
local colors = {
 +
clBlack                  = H("00000000"),
 +
clMaroon                  = H("00000080"),
 +
clGreen                  = H("00008000"),
 +
clOlive                  = H("00008080"),
 +
clNavy                    = H("00800000"),
 +
clPurple                  = H("00800080"),
 +
clTeal                    = H("00808000"),
 +
clGray                    = H("00808080"),
 +
clSilver                  = H("00C0C0C0"),
 +
clRed                    = H("000000FF"),
 +
clLime                    = H("0000FF00"),
 +
clYellow                  = H("0000FFFF"),
 +
clBlue                    = H("00FF0000"),
 +
clFuchsia                = H("00FF00FF"),
 +
clAqua                    = H("00FFFF00"),
 +
clWhite                  = H("00FFFFFF"),
 +
clMoneyGreen              = H("00C0DCC0"),
 +
clSkyBlue                = H("00F0CAA6"),
 +
clCream                  = H("00F0FBFF"),
 +
clMedGray                = H("00A4A0A0"),
 +
clNone                    = H("1FFFFFFF"),
 +
clDefault                = H("20000000"),
 +
clActiveBorder            = H("FF00000A"),
 +
clActiveCaption          = H("FF000002"),
 +
clAppWorkSpace            = H("FF00000C"),
 +
clBackground              = H("FF000001"),
 +
clBtnFace                = H("FF00000F"),
 +
clBtnHighlight            = H("FF000014"),
 +
clBtnShadow              = H("FF000010"),
 +
clBtnText                = H("FF000012"),
 +
clCaptionText            = H("FF000009"),
 +
clGradientActiveCaption  = H("FF00001B"),
 +
clGradientInactiveCaption = H("FF00001C"),
 +
clGrayText                = H("FF000011"),
 +
clHighlight              = H("FF00000D"),
 +
clHighlightText          = H("FF00000E"),
 +
clHotLight                = H("FF00001A"),
 +
clInactiveBorder          = H("FF00000B"),
 +
clInactiveCaption        = H("FF000003"),
 +
clInactiveCaptionText    = H("FF000013"),
 +
clInfoBk                  = H("FF000018"),
 +
clInfoText                = H("FF000017"),
 +
clMenu                    = H("FF000004"),
 +
clMenuBar                = H("FF00001E"),
 +
clMenuHighlight          = H("FF00001D"),
 +
clMenuText                = H("FF000007"),
 +
clScrollBar              = H("FF000000"),
 +
cl3DDkShadow              = H("FF000015"),
 +
cl3DLight                = H("FF000016"),
 +
clWindow                  = H("FF000005"),
 +
clWindowFrame            = H("FF000006"),
 +
clWindowText              = H("FF000008"),
 +
}
 +
 
 +
You can also build an arbitrary color from individual red,green and blue intensities with a function like the following:
 +
 
 +
-- red, green, and blue intensity values are integers from range 0-255
 +
function colorRBG(red, green, blue)
 +
  return red + Bit.Shl(green, 8) + Bit.Shl(blue, 16)
 +
end

Latest revision as of 08:31, 25 February 2013

RW Color : n

Specifies the background color of the control.

Use Color to read or change the background color of the control. Colors are specified by number, the underlying 32-bit BGR color format is the same as for the Delphi TColor type, with some special values assigned when the most significant byte value is 0xFF:

local function H(s)
 return tonumber(s,16)
end
local colors = {
clBlack                   = H("00000000"),
clMaroon                  = H("00000080"),
clGreen                   = H("00008000"),
clOlive                   = H("00008080"),
clNavy                    = H("00800000"),
clPurple                  = H("00800080"),
clTeal                    = H("00808000"),
clGray                    = H("00808080"),
clSilver                  = H("00C0C0C0"),
clRed                     = H("000000FF"),
clLime                    = H("0000FF00"),
clYellow                  = H("0000FFFF"),
clBlue                    = H("00FF0000"),
clFuchsia                 = H("00FF00FF"),
clAqua                    = H("00FFFF00"),
clWhite                   = H("00FFFFFF"),
clMoneyGreen              = H("00C0DCC0"),
clSkyBlue                 = H("00F0CAA6"),
clCream                   = H("00F0FBFF"),
clMedGray                 = H("00A4A0A0"),
clNone                    = H("1FFFFFFF"),
clDefault                 = H("20000000"),
clActiveBorder            = H("FF00000A"),
clActiveCaption           = H("FF000002"),
clAppWorkSpace            = H("FF00000C"),
clBackground              = H("FF000001"),
clBtnFace                 = H("FF00000F"),
clBtnHighlight            = H("FF000014"),
clBtnShadow               = H("FF000010"),
clBtnText                 = H("FF000012"),
clCaptionText             = H("FF000009"),
clGradientActiveCaption   = H("FF00001B"),
clGradientInactiveCaption = H("FF00001C"),
clGrayText                = H("FF000011"),
clHighlight               = H("FF00000D"),
clHighlightText           = H("FF00000E"),
clHotLight                = H("FF00001A"),
clInactiveBorder          = H("FF00000B"),
clInactiveCaption         = H("FF000003"),
clInactiveCaptionText     = H("FF000013"),
clInfoBk                  = H("FF000018"),
clInfoText                = H("FF000017"),
clMenu                    = H("FF000004"),
clMenuBar                 = H("FF00001E"),
clMenuHighlight           = H("FF00001D"),
clMenuText                = H("FF000007"),
clScrollBar               = H("FF000000"),
cl3DDkShadow              = H("FF000015"),
cl3DLight                 = H("FF000016"),
clWindow                  = H("FF000005"),
clWindowFrame             = H("FF000006"),
clWindowText              = H("FF000008"),
}

You can also build an arbitrary color from individual red,green and blue intensities with a function like the following:

-- red, green, and blue intensity values are integers from range 0-255
function colorRBG(red, green, blue)
 return red + Bit.Shl(green, 8) + Bit.Shl(blue, 16)
end