From: Vu Nhat Minh Date: Wed, 2 Jul 2014 08:39:20 +0000 (+0900) Subject: add 256 RGB supported X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=92be926e9093ad23c463ba39c94047d883e779be;p=rainbowstream.git add 256 RGB supported --- 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]