I needed to build this look up table so I thought I'd share it. It's based on a 'Standard list' found on the internet that seems to match up fairly closely with the colors in the designer, let me know if you find any glaring omissions.
I have added the control colors that appear in the designer, some of which duplicate standard colors (or themselves). So when looking up from an int, you may get a standard color name as opposed to the control color name you were expecting. And if you can't remember what you were expecting, that's all well and good
.
The library contains 6 Methods:
SLColorLUT
Author: Steve Laming
Version: 1
The B4A Reference App builds a listview showing the color, color name, hex and int for all colors in the table. A handy reference.
It's a B4A only library.
Copy the jar and xml files to your addl libs folder.
I hope you find it useful.
V1.01 attached
Added Reference App.
New version compiled for B4a 3 Beta3. Please download this version if you are using B4a V3 beta 3 or later.
I have added the control colors that appear in the designer, some of which duplicate standard colors (or themselves). So when looking up from an int, you may get a standard color name as opposed to the control color name you were expecting. And if you can't remember what you were expecting, that's all well and good
The library contains 6 Methods:
SLColorLUT
Author: Steve Laming
Version: 1
- Methods:
- GetAllNames As String()
Returns all color names in an array - Sorted
GetColorAlpha(ColorInt As int) As int
Returns the alpha value of ColorInt
GetColorInt(ColorName As String) As int
Returns a color int from a color name
GetColorName(ColorInt As int) As String
Returns a color name from a color int
GetRGB(color As int) As int()
Returns the RGB colors in a array (r,g,b)
GetRGBHex(color As int) As String
Returns the RGB Hex string in a "#rrggbb"
Initialize As String
Initializes the Object.
IsInitialized As boolean
Tests whether the object has been initialized.
Depends on:
javaobject
- GetAllNames As String()
The B4A Reference App builds a listview showing the color, color name, hex and int for all colors in the table. A handy reference.
It's a B4A only library.
Copy the jar and xml files to your addl libs folder.
I hope you find it useful.
V1.01 attached
Added Reference App.
New version compiled for B4a 3 Beta3. Please download this version if you are using B4a V3 beta 3 or later.
Attachments
Last edited: