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
*/
};