From e49f760510543d6723c3bde4e0d3b84aea86bbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Fri, 25 Jan 2013 09:37:03 +0100 Subject: [PATCH] Use hex strings for RGB colors in colorschemes Previously you'd have to convert a hex number to an integer, this change makes it possible to use a hex string instead which is much more useful. --- docs/source/configuration.rst | 6 +++--- powerline/colorscheme.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 844b8aad..736666d4 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -99,9 +99,9 @@ Colorschemes color, and the value is one of the following: * A cterm color index. - * A list of two integers, where the first integer is a cterm color - index, and the second is an RGB/hex color. This is useful for - colorschemes that use colors that aren't available in color terminals. + * A list with a cterm color index and a hex color string (e.g. ``[123, + "aabbcc"]``). This is useful for colorschemes that use colors that + aren't available in color terminals. ``groups`` .. _config-colorscheme-groups: diff --git a/powerline/colorscheme.py b/powerline/colorscheme.py index 89330603..f8801c08 100644 --- a/powerline/colorscheme.py +++ b/powerline/colorscheme.py @@ -12,7 +12,7 @@ class Colorscheme(object): # Create a dict of color tuples with both a cterm and hex value for color_name, color in colorscheme['colors'].items(): try: - self.colors[color_name] = (color[0], color[1]) + self.colors[color_name] = (color[0], int(color[1], 16)) except TypeError: self.colors[color_name] = (color, cterm_to_hex[color])