How to reverse engineer the colors in Excel?

R
Posted By
Ramon
Apr 7, 2010
Views
1225
Replies
4
Status
Closed
I think some Photoshop experts probably know how to do this….

I have an existent spreadsheet that has 3 shades of blue. I am writing a program to generate spreadsheets similar to that one. The application is based on the ExcelFormat SDK which contains hexadecimal color definitions.

I can "click-pick" the RGB color components with Photoshop, but how do I convert it to the hex format expected by Excel?

TIA,

-Ramon

———————————————————-

// predefined Excel color definitions
enum EXCEL_COLORS {
EGA_BLACK = 0, // 000000H
EGA_WHITE = 1, // FFFFFFH
EGA_RED = 2, // FF0000H
EGA_GREEN = 3, // 00FF00H
EGA_BLUE = 4, // 0000FFH
EGA_YELLOW = 5, // FFFF00H
EGA_MAGENTA = 6, // FF00FFH
EGA_CYAN = 7 // 00FFFFH
};

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

R
Ragnar
Apr 8, 2010
Entering "convert rgb to hex" in Google brings up a millions hits including http://www.javascripter.net/faq/rgbtohex.htm
HTH
R.

"Ramon F Herrera" wrote in message
I think some Photoshop experts probably know how to do this….
I have an existent spreadsheet that has 3 shades of blue. I am writing a program to generate spreadsheets similar to that one. The application is based on the ExcelFormat SDK which contains hexadecimal color definitions.

I can "click-pick" the RGB color components with Photoshop, but how do I convert it to the hex format expected by Excel?

TIA,

-Ramon

———————————————————-
// predefined Excel color definitions
enum EXCEL_COLORS {
EGA_BLACK = 0, // 000000H
EGA_WHITE = 1, // FFFFFFH
EGA_RED = 2, // FF0000H
EGA_GREEN = 3, // 00FF00H
EGA_BLUE = 4, // 0000FFH
EGA_YELLOW = 5, // FFFF00H
EGA_MAGENTA = 6, // FF00FFH
EGA_CYAN = 7 // 00FFFFH
};
R
Ramon
Apr 8, 2010
On Apr 8, 2:55 am, "Ragnar" wrote:
Entering "convert rgb to hex" in Google
brings up a millions hits including
http://www.javascripter.net/faq/rgbtohex.htm

Thanks!

HTH

It definitely does…

-Ramon
AM
Andrew Morton
Apr 8, 2010
Ramon F Herrera wrote:
I have an existent spreadsheet that has 3 shades of blue. I am writing a program to generate spreadsheets similar to that one. The application is based on the ExcelFormat SDK which contains hexadecimal color definitions.

I can "click-pick" the RGB color components with Photoshop, but how do I convert it to the hex format expected by Excel?

"Click-pick" the colour then click the foreground colour in the tools palette. The RGB representation is in the box at the bottom of the dialog.


Andrew
R
Ramon
Apr 8, 2010
On Apr 8, 5:41 am, "Andrew Morton"
wrote:
Ramon F Herrera wrote:
I have an existent spreadsheet that has 3 shades of blue. I am writing a program to generate spreadsheets similar to that one. The application is based on the ExcelFormat SDK which contains hexadecimal color definitions.

I can "click-pick" the RGB color components with Photoshop, but how do I convert it to the hex format expected by Excel?

"Click-pick" the colour then click the foreground colour in the tools palette. The RGB representation is in the box at the bottom of the dialog..

Andrew

Thanks, Andrew:

Your tip certainly removes one level of uncertainty. I compared both methods (yours and the one suggested by Ragnar) and they give the same results. The world makes sense, for a change. 🙂

Back to my original problem: it seems that the library I use to create Excel spreadsheets programmatically can only deal with 16-bit colors, and Microsoft -always so shrewd- uses the nicer shades to stay one step ahead of the competition (read: open source solutions).

See below the colors that come with the "ExcelFormat" library and the 3 that I would like to use.

Thanks,

-Ramon

————————

Note: the values below are shifted to convert them to 2 bytes (16 bit) values.

enum EXCEL_COLORS {
EGA_BLACK = 0, // 000000H
EGA_WHITE = 1, // FFFFFFH
EGA_RED = 2, // FF0000H
EGA_GREEN = 3, // 00FF00H
EGA_BLUE = 4, // 0000FFH
EGA_YELLOW = 5, // FFFF00H
EGA_MAGENTA = 6, // FF00FFH
EGA_CYAN = 7 // 00FFFFH
/*
LIGHT_BLUE = xDBE5F1, // DBE5F1H Ok
MEDIUM_BLUE = xB8CCE4, // B8CCE4H Ok
DARK_BLUE = x4F81BD // 4F81BDH Ok
*/
};

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

Related Discussion Topics

Nice and short text about related topics in discussion sections