• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Looking for color chart

Eloise T

Active Member
Red is equal to all the following: -16776961 vbRed RGB(255, 0, 0)

I'm looking for a chart that lists the other colors like -16776961 and
a similar chart for "vb" colors.

Thank you.
 
I need to be able to look up a number like -16776961 and determine it's red.

Where is the drop-down window in Excel in your picture above?
 
I do not know of a chart but it is reasonably easy to write a macro that will colour a shape to conform to a specified value (often quoted as Hex numbers "0000FF" - red for example). Conversely, if you have a coloured shape you can return its RGB value.

Code:
Sub Hexagon1_Click()
Dim shp As Shape
Dim shpName
Dim Color
shpName = Application.Caller
Set shp = ActiveSheet.Shapes(shpName)
Color = Range("Color").Value
shp.Fill.ForeColor.RGB = Color
End Sub

or

Code:
Sub Hexagon1_Test()
Dim shp As Shape
Dim shpName
Dim Color
shpName = "Hexagon 1"
Set shp = ActiveSheet.Shapes(shpName)
Color = shp.Fill.ForeColor.RGB
Range("Color").Value = Color
End Sub

Your number, when converted to Hex, has a leading FFFF before the 00 (blue) 00 (green) FF (red). That makes it convert to a negative decimal number but I do not know what it does in terms of the colour.
 
You put a knife in the hands of a two-year old. I'm the two-year old.
Before I try all kinds of substitutions, how do I implement either of the macros?
 
Eloise T
Who knows is that only from Apple?
Have You tried to select eg background color with any Excel?
> For me, there is 'More colors...' and
after that there are many possibilities to work with those.

Where have You find that -16776961 is as RBG(255,0,0)?
 
vbRed should be 3.

VB color constants are listed in link below.
https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/color-constants

You can easily create your own conversion for these constants.
Code:
Sub Demo()
Dim ar
ar = Array(vbBlack, vbRed, vbGreen, vbYellow, vbBlue, vbMagenta, vbCyan, vbWhite)
For i = LBound(ar) To UBound(ar)
    Cells(i + 1, "A").Interior.Color = ar(i)
    Cells(i + 1, "B").Value = Cells(i + 1, "A").Interior.ColorIndex
Next
End Sub

For RGB have a read of link below.
https://excelribbon.tips.net/T010180_Determining_the_RGB_Value_of_a_Color.html
 
This is not a chart but it allows you to input a hex number and apply it to a shape or the reverse (the original shape colours were washed out because they were set to 50% transparency :oops:)
 

Attachments

  • Colours.xlsm
    19.9 KB · Views: 5
Last edited:
Eloise T
Who knows is that only from Apple?
Have You tried to select eg background color with any Excel?
> For me, there is 'More colors...' and
after that there are many possibilities to work with those.

Where have You find that -16776961 is as RBG(255,0,0)?
My "More colors" looks like these two pictures:
upload_2019-1-16_13-40-0.png
upload_2019-1-16_13-40-54.png

I don't know where I found -16776961 is as RBG(255,0,0)
All I do know is that -16776961 works as a replacement for
RBG(255,0,0) or vbRed. Hence the desire to find the "hard
to find" chart or table.
 
This is not a chart but it allows you to input a hex number and apply it to a shape or the reverse (the original shape colours were washed out because they were set to 50% transparency :oops:)
Interesting that the -16776961 turns out to be decimal equivalent to FFFF0000FF. That number is making more sense...not completely, but more. :)
 
Eloise T
Who knows is that only from Apple?
Have You tried to select eg background color with any Excel?
> For me, there is 'More colors...' and
after that there are many possibilities to work with those.

Where have You find that -16776961 is as RBG(255,0,0)?
I have now learned that -16776961 was converted from HEX FFFF0000FF.
Eloise T
Your 'Custom' is as same as mine only Hex-value is missing.
Red ~ RGB(255,0,0) ~ #FF0000
FFFF0000FF .. hmm? but with which rule?
...and I'll keep hunting until I find a good answer.
 
vletm
Agreeing most of the way but I think you have highlighted the wrong part of the hex string.
FFFF0000FF .. hmm? but with which rule?
I believe the highlight should be applied to the final six characters.
FFFF 00 00 FF
The final (least significant) two control red, the next two control green and the most significant control blue. What I do not know is the significance to the first four characters (16 bits). It seems that filling the sequence with 0 or 1 is OK and gives the same colour but other values crash VBA.
 
vletm
Agreeing most of the way but I think you have highlighted the wrong part of the hex string.

I believe the highlight should be applied to the final six characters.
FFFF 00 00 FF
The final (least significant) two control red, the next two control green and the most significant control blue. What I do not know is the significance to the first four characters (16 bits). It seems that filling the sequence with 0 or 1 is OK and gives the same colour but other values crash VBA.
I agree.
 
Peter Bartholomew
I highlighted same part which means for me Red ~ FF0000;
with question: but with which rule?
Without clear rule,
no matter of thinking or believe this could be whatever.
Eg:

I also found one page, which shows that -16776961 is Aqua-color.
Screenshot 2019-01-17 at 09.59.50.png
That was so clear!
Of course, there are also page, that it would use for red-color too.

I use RGB(255,0,0) for 'red'; and there are many red-colors.
 
vletm
The code -16776961 (FFFF0000FF) definitely gives Red on a PC, as does 255 (FF).
I agree that the RGB function is clearer to read though working with Hex representation is not that difficult. For example 0080FF, RGB(0, 127, 255) gives orange, as does FFFF0080FF. The decimal equivalents are pretty unintelligible.

Eloise
If you were keen to have a chart, you are now in a position to create your own, maybe colouring cell interiors rather than shapes. If you want 'poetic' names for the colours, such as Pantone "Fuchsia Rose" or "Tangerine Tango" that is another kettle of fish! :)
 
Just to 'put my money where my mouth is'
(with apologies to non-native English speakers).

Code:
Sub ColorCells()
Dim c As Range
    For Each c In [Decimal]
        c.Offset(0, 1).Interior.Color = c.Value
    Next c
End Sub

Instructions: Click 'Color' heading to recolour black cells.
 

Attachments

  • Colours.xlsm
    22.8 KB · Views: 6
Back
Top