From 92be926e9093ad23c463ba39c94047d883e779be Mon Sep 17 00:00:00 2001 From: Vu Nhat Minh Date: Wed, 2 Jul 2014 17:39:20 +0900 Subject: [PATCH] add 256 RGB supported --- rainbowstream/colorset/default.json | 21 ++++++++++++++++++++- rainbowstream/config.py | 7 +++---- rainbowstream/draw.py | 2 ++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/rainbowstream/colorset/default.json b/rainbowstream/colorset/default.json index bb9ff1c..7c42226 100644 --- a/rainbowstream/colorset/default.json +++ b/rainbowstream/colorset/default.json @@ -22,7 +22,26 @@ "PUBLIC_DOMAIN" : "stream.twitter.com", "SITE_DOMAIN" : "sitestream.twitter.com", - // Color config + /* Color config + There are 16 basic colors supported : + * default + * black + * red + * green + * yellow + * blue + * magenta + * cyan + * grey + * light_red + * light_green + * light_yellow + * light_blue + * light_magenta + * light_cyan + * white + + */ "TWEET" : { "nick" : "grey", "clock" : "grey", diff --git a/rainbowstream/config.py b/rainbowstream/config.py index c079d87..de49969 100644 --- a/rainbowstream/config.py +++ b/rainbowstream/config.py @@ -11,6 +11,9 @@ comment_re = re.compile( ) def load_config(filepath): + """ + Load config from filepath + """ try: with open(filepath) as f: content = ''.join(f.readlines()) @@ -24,10 +27,6 @@ def load_config(filepath): except: pass -# Image config -IMAGE_SHIFT = 10 -IMAGE_MAX_HEIGHT = 40 - # Load colorset default_config = 'rainbowstream/colorset/default.json' rainbow_config = os.environ.get('HOME', os.environ.get('USERPROFILE','')) + os.sep + '.rainbow_config.json' diff --git a/rainbowstream/draw.py b/rainbowstream/draw.py index e949fb2..d3cbc66 100644 --- a/rainbowstream/draw.py +++ b/rainbowstream/draw.py @@ -21,6 +21,8 @@ def color_func(func_name): Call color function base on name """ pure = func_name.encode('utf8') + if pure.startswith('RGB_') and pure[4:].isdigit(): + return RGB(int(pure[4:]) return globals()[pure] -- 2.25.1