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.
make_palette
(strings)[source]¶ Makes a color palette from a collection of strings.
-
xonsh.color_tools.
make_pallete
(*args, **kwargs)[source]¶ make_pallete has been deprecated in version 0.5.10 and will be removed in version 0.6.0
-
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.