<DEATH> double Luminance(t_uint32 color) {
<DEATH> double r = extractbyte(color,0), g = extractbyte(color,1), b = extractbyte(color,2);
<DEATH> return (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255.0;
<DEATH> //return (r * 0.3 + g * 0.59 + b * 0.11) / 255.0;
<DEATH> }
<DEATH> t_uint32 DetermineTextColor(t_uint32 bk) {
<DEATH> return Luminance(bk) > 0.6 ? 0 : 0xFFFFFF;
<DEATH> }
<DEATH> I use DetermineTextColor() for text color when the item is selected, instead of the user-configured text color.
<bubbleguuum> thanks i'll use it
<Neptune> If you could share your formula for alternating list background while you're at it?
<DEATH> t_uint32 DriftColor(t_uint32 p_color,unsigned p_delta,bool p_direction) throw() {
<DEATH> t_uint32 ret = 0;
<DEATH> for(t_size walk = 0; walk < 3; ++walk) {
<DEATH> unsigned val = extractbyte(p_color,walk);
<DEATH> if (p_direction) val = 0xFF - val;
<DEATH> if (val < p_delta) val = p_delta;
<DEATH> val += p_delta;
<DEATH> if (val > 0xFF) val = 0xFF;
<DEATH> if (p_direction) val = 0xFF - val;
<DEATH> ret |= (t_uint32)val << (walk * 8);
<DEATH> }
<DEATH> return ret;
<DEATH> }
<DEATH> const DWORD bkColor = DriftColor(bkColor_base,4, (p_item&1) != 0);