[IPython-dev] default colorscheme

Min RK benjaminrk at gmail.com
Wed Jul 6 03:30:54 EDT 2011


On Jul 6, 2011, at 0:10, Fernando Perez <fperez.net at gmail.com> wrote:

> On Tue, Jul 5, 2011 at 10:50 PM, MinRK <benjaminrk at gmail.com> wrote:
>> what's the best way to
>> evaluate whether an rgb value is 'light' or 'dark'?
> 
> Quick and dirty:
> 
> light = (r+g+b)/3.0 > 0.5
> 
> assuming (r,g,b) normalized to 0-1, adjust accordingly if they're in 0-255.

That should cover just about everything people will actually use, but just for fun is green 255 dark, as that formula would suggest?

By that formula, rgb(60,255,60) is also dark, which is pretty far from true. It's also pretty hideous, so not a specific edge case we should worry about.

(I'm not suggesting that we use a more precise formula, just noting that the average doesn't always get the right answer).

-MinRK

> 
> Cheers,
> 
> f



More information about the IPython-dev mailing list