View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Are there apis that relate colour index with color?

This article says very clearly that the VB method of storing colors is
different from RRGGBB

http://support.microsoft.com/default...53&Product=vb6
INFO: Do Not Use Visual Basic Color Constants in DHTML Page Designer

Activeworkbook.Colors(6) gives the long number format of the BBGGRR value
for the color pallet.
I think you would need to loop the palette to go the other way.

--
Regards,
Tom Ogilvy


Tom Ogilvy wrote in message
...
It depends on what you mean by API, but if you mean windows API's then no,
they have no knowledge or interaction with Excel's internal method of
managing colors for cells and fonts.

RGB, QBColor, Color and colorIndex are the only functions that I can think
of that deal with colors and David gives a pretty good explanation of most
of those.

--
Regards,
Tom Ogilvy



Jan Nordgreen wrote in message
...
Thanks.

When I searched for the answer to my question, I looked at his colourful
page, but did not find any api functions.

He gets the color values by reading cells he has set the color index of.

( Cells(i + 1, 2).Font.colorindex = i
Cells(i + 1, 2).Value = "[Color " & i & "]"
str0 = Right("000000" & Hex(Cells(i + 1, 1).Interior.color), 6))

I was wondering if there is a direct link.

Sincerely,

Jan Nordgreen

"Tom Ogilvy" wrote in message
...
Maybe there is some information here at David McRitchie's site:

http://www.mvps.org/dmcritchie/excel/colors.htm

--
Regards,
Tom Ogilvy

Jan Nordgreen wrote in message
...
The relationship between the forty colour index number you get from

the
default colour palette when you press Fill Color and the background

colour
values is given below if you swap the last two digist with the two

first.

My query is: do apis exist that calculates the one given the other?

Sincerely,

Jan Nordgreen
Santa Cruz, Bolivia

aPalColour(1) = "000000"
aPalColour(2) = "FFFFFF"
aPalColour(3) = "FF0000"
aPalColour(4) = "00FF00"
aPalColour(5) = "0000FF"
aPalColour(6) = "FFFF00"
aPalColour(7) = "FF00FF"
aPalColour(8) = "00FFFF"
aPalColour(9) = "800000"
aPalColour(10) = "008000"
aPalColour(11) = "000080"
aPalColour(12) = "808000"
aPalColour(13) = "800080"
aPalColour(14) = "008080"
aPalColour(15) = "C0C0C0"
aPalColour(16) = "808080"
aPalColour(33) = "00CCFF"
aPalColour(34) = "CCFFFF"
aPalColour(35) = "CCFFCC"
aPalColour(36) = "FFFF99"
aPalColour(37) = "99CCFF"
aPalColour(38) = "FF99CC"
aPalColour(39) = "CC99FF"
aPalColour(40) = "FFCC99"
aPalColour(41) = "3366FF"
aPalColour(42) = "33CCCC"
aPalColour(43) = "99CC00"
aPalColour(44) = "FFCC00"
aPalColour(45) = "FF9900"
aPalColour(46) = "FF6600"
aPalColour(47) = "666699"
aPalColour(48) = "969696"
aPalColour(49) = "003366"
aPalColour(50) = "339966"
aPalColour(51) = "003300"
aPalColour(52) = "333300"
aPalColour(53) = "993300"
aPalColour(54) = "993366"
aPalColour(55) = "333399"
aPalColour(56) = "333333"