Oscar,
Use RGBColor() to decompose a color into its R, G and B values. If the value is less than 128 it's "dark", greater that 128 it's "light". You might then try adding all three together nTotal = nRed + nGreen + nBblue and if the total is less than 3*128 use white background and black otherwise.
>I need to make the text readable no matter the back color. I tried setting dynamicforecolor to bitxor(dynamicbackcolor, rgb(255,255,255)), but the results are disgusting
>
>I want to set dynamicforecolor to black if the back color is light and to white if the back color is dark. But I cannot find a function that reliably tells me the "intensity" or "luminance" of the color...