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 bb9ff1c..7c42226 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 c079d87..de49969 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 e949fb2..d3cbc66 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]