Color Tools (xonsh.color_tools)

Tools for color handling in xonsh.

This includes Convert values between RGB hex codes and xterm-256 color codes. Parts of this file were originally forked from Micah Elliott http://MicahElliott.com Copyright (C) 2011 Micah Elliott. All rights reserved. WTFPL http://sam.zoy.org/wtfpl/

xonsh.color_tools.color_dist(x, y)[source]
xonsh.color_tools.find_closest_color(x, pallette)[source]
xonsh.color_tools.make_pallete(strings)[source]

Makes a color pallete from a colection of strings.

xonsh.color_tools.rgb2short(rgb)

Find the closest ANSI 256 approximation to the given RGB value.

>>> rgb2short('123456')
('23', '005f5f')
>>> rgb2short('ffffff')
('231', 'ffffff')
>>> rgb2short('0DADD6') # vimeo logo
('38', '00afd7')
Parameters:rgb : Hex code representing an RGB value, eg, ‘abcdef’
Returns:String between 0 and 255, compatible with xterm.
xonsh.color_tools.rgb_to_256(rgb)[source]

Find the closest ANSI 256 approximation to the given RGB value.

>>> rgb2short('123456')
('23', '005f5f')
>>> rgb2short('ffffff')
('231', 'ffffff')
>>> rgb2short('0DADD6') # vimeo logo
('38', '00afd7')
Parameters:rgb : Hex code representing an RGB value, eg, ‘abcdef’
Returns:String between 0 and 255, compatible with xterm.
xonsh.color_tools.rgb_to_ints(rgb)[source]
xonsh.color_tools.short2rgb(short)[source]