Excel color palette


Posted by Mary Coudron on December 27, 2001 9:20 AM

What are the RGB equivalents to the standard color palette in Excel?

Posted by Juan Pablo G. on December 27, 2001 9:47 AM

I've always wondered about this, but never had done anything about it. In a blank sheet use this macro to get Number and colors.

Sub Colors()
For i = 1 To 56
With Cells(i, 1)
.Value = i
.Interior.ColorIndex = i
End With
Next i
End Sub

Then, in range B1:D56 put this table, they are RED - GREEN - BLUE code for each (At least on my default settings...)

{0,0,0;255,255,255;255,0,0;0,255,0;0,0,255;255,255,0;255,0,255;0,255,255;128,0,0;0,128,0;0,0,128;128,128,0;128,0,128;0,128,128;192,192,192;128,128,128;153,153,255;153,51,102;255,255,204;204,255,255;102,0,102;255,128,128;0,102,204;204,204,255;0,0,128;255,0,255;255,255,0;0,255,255;128,0,128;128,0,0;0,128,128;0,0,255;0,204,255;204,255,255;204,255,204;255,255,153;153,204,255;255,153,204;204,153,255;255,204,153;51,102,255;51,204,204;153,204,0;255,204,0;255,153,0;255,102,0;102,102,153;150,150,150;0,51,102;51,153,102;0,51,0;51,51,0;153,51,0;153,51,102;51,51,153;51,51,51}

It's a long one, 56 colors.

Juan Pablo G.



Posted by Ivan F Moala on December 27, 2001 10:53 PM

Try this to get default colors/index, RGB values
and the LongValue.

Sub GetRGB_ColorIndex()
Dim k, x As Single

'1st Clear Old data
Range([A1:F1], [A1:F1].End(xlDown)).Select
Selection.Clear

x = 1

Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False

[A1] = "ColorIndex"
[B1] = "Color"
[C1] = "LongValue"
[D1] = "RED"
[E1] = "GREEN"
[F1] = "BLUE"


For Each k In ActiveWorkbook.Colors
Cells(x + 1, 1) = x
Cells(x + 1, 2).Interior.ColorIndex = x
Cells(x + 1, 3) = k
Cells(x + 1, 4) = Cells(x + 1, 3).Value And &HFF
Cells(x + 1, 5) = (Cells(x + 1, 3).Value And &H100FF00) / &H100
Cells(x + 1, 6) = (Cells(x + 1, 3).Value And &HFF0000) / &H10000
x = x + 1
Next

Selection.Columns.AutoFit
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub

Ivan