Matteo Cavalleri wrote:

> ok, i took the rgb values from that image of the xterm colors (using
> the gist linked in the image itself) and wrote a little ruby script to
> print 1 or 0 depending on the brightness of the color.
> 
> according to the source snippet posted by Christian, it seems that
> when "i" is true then the background is set to dark, otherwise to
> "light", so my script prints 1 for dark colors and 0 for light ones. I
> don't work with c, so I'm not sure if an array of integers is really
> the best option for a quick look up depending on the color index, but
> anyway, modifying my script shouldn't be too difficult :p
> 
> I made this just for those 256 term colors, looking at that snippet of
> vim source. I've no idea what happens when the gui is in use...
> 
> BTW I've to say I'm totally ignorant about luma, luminance, gamma
> correction etc, so i basically took a formula from someone who seemed
> to know what he was talking about and used it...
> 
> here's the output and the script attached. I hope I made something useful :)
> 
> 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
> 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1
> 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1
> 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
> 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1
> 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

To see if this is right we would need to make areas with the background
color, put some white and black text in it, and check which text is best
readable.

For the first 16 colors it's a bit different, but that doesn't mean it
is wrong (e.g. blue is considered light, but it's actually quite dark).


-- 
There are three kinds of persons: Those who can count and those who can't.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui