Tool Color Look Up Table (LUT)

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

  • 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

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

  • ColorLUT.zip
    12.8 KB · Views: 483
  • Reference.zip
    5.6 KB · Views: 469
  • SLColorLUT-3Beta3+.zip
    7.1 KB · Views: 435
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Thanx for sharing this.

I get an error while compiling the Example: "A referenced library is missing: slarrays"
 

stevel05

Expert
Licensed User
Longtime User
Ah OK, just deselect it in the libs pane, it's not needed. I'll upload a new version. I must have been click happy:)
 

DonManfred

Expert
Licensed User
Longtime User
I dont have this Library and therefor i cannot deselect it in the Libs-pane.

There are only two libs marked in the b4a-file:
NumberOfLibraries=2
Library1=core
Library2=slcolorlut

And the second, i think, is needed for the example, right? There is no slarreys referenced. I think it must be a reference from your library.

In your Lib-XML stands:
<dependsOn>slarrays</dependsOn>

Can i remove that line from XML-File or should i wait for a new upload?
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
Of course, try downloading it again now.

I think I had it selected when I compiled the library. Something to watch out for.
 

stevel05

Expert
Licensed User
Longtime User
Update to V1.01 adds three methods:

getRGB, getRGBHex and GetColorAlpha

getRGB returns the RGB values as an array.

getRGBHex returns the RGB values as a hex string in the form #rrggbb

getColorAlpha returns the alpha content of the color.
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
Added B4A reference app which shows color, color name, hex and int values for all the colors in the table.
 
Top