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/
- class xonsh.color_tools.COLORS[source]¶
constants
- BOLD_GREEN = '{BOLD_GREEN}'¶
- BOLD_RED = '{BOLD_RED}'¶
- GREEN = '{GREEN}'¶
- RED = '{RED}'¶
- RESET = '{RESET}'¶
- xonsh.color_tools.make_palette(strings)[source]¶
Makes a color palette from a collection 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:
- rgbHex code representing an RGB value, eg, ‘abcdef’
- Returns:
- Tuple of String between 0 and 255 (compatible with xterm) and
- hex code (length-6).
- 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:
- rgbHex code representing an RGB value, eg, ‘abcdef’
- Returns:
- Tuple of String between 0 and 255 (compatible with xterm) and
- hex code (length-6).