Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Are there apis that relate colour index with color?
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" |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Are there apis that relate colour index with color?
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" |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Are there apis that relate colour index with color?
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" |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Are there apis that relate colour index with color?
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" |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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" |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Are there apis that relate colour index with color?
Jan..
The colors are stored in the workbook's Colors property it's an array of long color values. Colorindex is 1 to 56. ActiveWorkbook.ResetColors resets the workbooks colors array to the defaults. Be careful converting the long to hex as this produces BGR not RGB!! Demo: type following in the immediate pane... :) msgbox hex(rgb(255,254,253)) You'll get the color as follows: Option Explicit Sub GetColors() Dim i&, lngColor&, strRGB$ For i = 1 To 56 'get the long lngColor = ActiveWorkbook.Colors(i) 'convert long to rgb hex strRGB = Lng2Rgb(lngColor) Cells(i, 1) = i Cells(i, 2) = lngColor Cells(i, 3) = "'" & strRGB Cells(i, 1).Resize(, 3).Interior.Color = lngColor Next End Sub Function Lng2Rgb$(lng&) Dim r, g, b r = (lng Mod (2 ^ 8)) \ 2 ^ 0 g = (lng Mod (2 ^ 16)) \ 2 ^ 8 b = (lng Mod (2 ^ 24)) \ 2 ^ 16 Lng2Rgb = Format(Hex(r), "00") & _ Format(Hex(g), "00") & _ Format(Hex(b), "00") End Function suc6! keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool "Jan Nordgreen" wrote: 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" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Custom Color/Color Index | Excel Discussion (Misc queries) | |||
Colour index | Excel Discussion (Misc queries) | |||
Chart axes color index vs font color index | Charts and Charting in Excel | |||
colour index matrix | Excel Discussion (Misc queries) | |||
Picture Transparency/Mask/Overlay .. no APIs | Excel Programming |