add 256 RGB supported
authorVu Nhat Minh <vunhat_minh@dwango.co.jp>
Wed, 2 Jul 2014 08:39:20 +0000 (17:39 +0900)
committerVu Nhat Minh <vunhat_minh@dwango.co.jp>
Wed, 2 Jul 2014 08:39:20 +0000 (17:39 +0900)
rainbowstream/colorset/default.json
rainbowstream/config.py
rainbowstream/draw.py

index bb9ff1c57ede83273d8bbb33626f69bd72b400e1..7c422265087859f4ea66bbcc983403c33c0bfa62 100644 (file)
     "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",
index c079d87b85e38d4526aa45488227402c8305cb91..de49969846a83d7712b02c192de2b37057bd684e 100644 (file)
@@ -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'
index e949fb28581cb60cfcc921b233533f50fba9fee5..d3cbc66d2d5a672e379b9082116695699aea6427 100644 (file)
@@ -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]