Openoffice's crazy ass native color values
If you ever write macros for openoffice, you can set background color of cells by setting the BackgroundColor property to an RGB value using the RGB function.
myval = RGB ( R, G, B )
R, G, and B are integers from 0-255 for Red, Blue and Green respectively. Any color program can get you those values from any point on your screen.
But what if you use the macro recorder to do part of your script and then you are confronted with a BackgroundColor value like 16765728 for a rich yellow? How would one look at the code and adjust the color?
What the hell is 16765728? It's 8 digits long, so is it hex like #FF33FF but with the last two digits for an alpha transparency value? No, it's not, cause the digits sizes in order seem to bear no relationship to the RGB values for that color (determinined separately as 255 211 32)... Is it some padded decimal to octal conversion or something? No, cause it has 8 in it. ???!! grrr...
So, it turns out to be this...
(R * 2^16) + (G * 2^8 ) + B
i.e. for RGB ( 255, 211 32 )
16765728 = 255 * 2^16 + 211 * 2^8 + 32
16765728 = 16711680 + 54016 + 32
Maybe that is an obvious value storage strategy to datastructure wizards who think that in field delimiters are dangerous, but to me it just makes openoffice basic impenetrable. I'll need a spreadsheet just to calculate how to program my spreasheet. Maybe I can just do integer division in my head, and watch the modulos.