term color define only by number
authorOrakaro <nhatminh_179@hotmail.com>
Tue, 15 Jul 2014 15:40:46 +0000 (00:40 +0900)
committerOrakaro <nhatminh_179@hotmail.com>
Tue, 15 Jul 2014 15:40:46 +0000 (00:40 +0900)
rainbowstream/colorset/init [deleted file]
rainbowstream/colorset/larapaste.json
rainbowstream/colorset/monokai.json
rainbowstream/colorset/solarized.json
rainbowstream/colorset/tomorrow_night.json
rainbowstream/draw.py
setup.py
theme.md

diff --git a/rainbowstream/colorset/init b/rainbowstream/colorset/init
deleted file mode 100755 (executable)
index 1d8a01d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-monokai\r
\ No newline at end of file
index 990b4f8..4763522 100644 (file)
         * light_magenta
         * light_cyan
         * white
-    and 256 terminal's colors from term_0 to term_255
+    and 256 terminal's colors from 0 to 255
     */
 
-    "DECORATED_NAME" : "term_73",
-    "CYCLE_COLOR" :["term_73","term_209","term_148","term_230","term_220","term_59"],
+    "DECORATED_NAME" : 73,
+    "CYCLE_COLOR" :[73,209,148,230,220,59],
     "TWEET" : {
-        "nick"      : "term_73",
-        "clock"     : "term_220",
-        "id"        : "term_209",
-        "favorited" : "term_148",
-        "rt"        : "term_59",
-        "link"      : "term_148",
+        "nick"      : 73,
+        "clock"     : 220,
+        "id"        : 209,
+        "favorited" : 148,
+        "rt"        : 59,
+        "link"      : 148,
         "keyword"   : "on_light_green"
     },
 
     "MESSAGE" : {
-        "sender"    : "term_73",
-        "recipient" : "term_73",
-        "to"        : "term_148",
-        "clock"     : "term_220",
-        "id"        : "term_209"
+        "sender"    : 73,
+        "recipient" : 73,
+        "to"        : 148,
+        "clock"     : 220,
+        "id"        : 209
     },
 
     "PROFILE" : {
-        "statuses_count"    : "term_209",
-        "friends_count"     : "term_73",
-        "followers_count"   : "term_220",
-        "nick"              : "term_73",
-        "profile_image_url" : "term_148",
-        "description"       : "term_230",
-        "location"          : "term_59",
-        "url"               : "term_148",
-        "clock"             : "term_220"
+        "statuses_count"    : 209,
+        "friends_count"     : 73,
+        "followers_count"   : 220,
+        "nick"              : 73,
+        "profile_image_url" : 148,
+        "description"       : 230,
+        "location"          : 59,
+        "url"               : 148,
+        "clock"             : 220
     },
 
     "TREND" : {
-        "url": "term_148"
+        "url": 148
     },
 
     "CAL" : {
-        "days": "term_209",
+        "days": 209,
         "today": "on_light_magenta"
     },
 
     "GROUP" : {
-        "name": "term_73",
-        "member": "term_220",
-        "subscriber": "term_73",
-        "mode": "term_59",
-        "description": "term_230",
-        "clock": "term_220"
+        "name": 73,
+        "member": 220,
+        "subscriber": 73,
+        "mode": 59,
+        "description": 230,
+        "clock": 220
     }
 }
index dc71fda..27d7982 100644 (file)
         * light_magenta
         * light_cyan
         * white
-    and 256 terminal's colors from term_0 to term_255
+    and 256 terminal's colors from 0 to 255
     */
 
-    "DECORATED_NAME" : "term_198",
-    "CYCLE_COLOR" :["term_198","term_57","term_166","term_50","term_179","term_74","term_112"],
+    "DECORATED_NAME" : 198,
+    "CYCLE_COLOR" :[198,57,166,50,179,74,112],
     "TWEET" : {
-        "nick"      : "term_112",
-        "clock"     : "term_57",
-        "id"        : "term_166",
-        "favorited" : "term_50",
-        "rt"        : "term_179",
-        "link"      : "term_74",
+        "nick"      : 112,
+        "clock"     : 57,
+        "id"        : 166,
+        "favorited" : 50,
+        "rt"        : 179,
+        "link"      : 74,
         "keyword"   : "on_light_green"
     },
 
     "MESSAGE" : {
-        "sender"    : "term_112",
-        "recipient" : "term_112",
-        "to"        : "term_50",
-        "clock"     : "term_57",
-        "id"        : "term_166"
+        "sender"    : 112,
+        "recipient" : 112,
+        "to"        : 50,
+        "clock"     : 57,
+        "id"        : 166
     },
 
     "PROFILE" : {
-        "statuses_count"    : "term_112",
-        "friends_count"     : "term_198",
-        "followers_count"   : "term_57",
-        "nick"              : "term_198",
-        "profile_image_url" : "term_74",
-        "description"       : "term_166",
-        "location"          : "term_112",
-        "url"               : "term_74",
-        "clock"             : "term_57"
+        "statuses_count"    : 112,
+        "friends_count"     : 198,
+        "followers_count"   : 57,
+        "nick"              : 198,
+        "profile_image_url" : 74,
+        "description"       : 166,
+        "location"          : 112,
+        "url"               : 74,
+        "clock"             : 57
     },
 
     "TREND" : {
-        "url": "term_74"
+        "url": 74
     },
 
     "CAL" : {
-        "days": "term_57",
+        "days": 57,
         "today": "on_light_blue"
     },
 
     "GROUP" : {
-        "name": "term_112",
-        "member": "term_57",
-        "subscriber": "term_198",
-        "mode": "term_112",
-        "description": "term_166",
-        "clock": "term_57"
+        "name": 112,
+        "member": 57,
+        "subscriber": 198,
+        "mode": 112,
+        "description": 166,
+        "clock": 57
     }
 }
index b3b3c2c..b73cc70 100644 (file)
         * light_magenta
         * light_cyan
         * white
-    and 256 terminal's colors from term_0 to term_255
+    and 256 terminal's colors from 0 to 255
     */
 
-    "DECORATED_NAME" : "term_64",
-    "CYCLE_COLOR" :["term_124","term_32","term_64","term_66","term_130","term_23"],
+    "DECORATED_NAME" : 64,
+    "CYCLE_COLOR" :[124,32,64,66,130,23],
     "TWEET" : {
-        "nick"      : "term_64",
-        "clock"     : "term_32",
-        "id"        : "term_124",
-        "favorited" : "term_64",
-        "rt"        : "term_66",
-        "link"      : "term_23",
+        "nick"      : 64,
+        "clock"     : 32,
+        "id"        : 124,
+        "favorited" : 64,
+        "rt"        : 66,
+        "link"      : 23,
         "keyword"   : "on_light_green"
     },
 
     "MESSAGE" : {
-        "sender"    : "term_64",
-        "recipient" : "term_64",
-        "to"        : "term_130",
-        "clock"     : "term_32",
-        "id"        : "term_124"
+        "sender"    : 64,
+        "recipient" : 64,
+        "to"        : 130,
+        "clock"     : 32,
+        "id"        : 124
     },
 
     "PROFILE" : {
-        "statuses_count"    : "term_124",
-        "friends_count"     : "term_32",
-        "followers_count"   : "term_130",
-        "nick"              : "term_64",
-        "profile_image_url" : "term_23",
-        "description"       : "term_66",
-        "location"          : "term_64",
-        "url"               : "term_23",
-        "clock"             : "term_32"
+        "statuses_count"    : 124,
+        "friends_count"     : 32,
+        "followers_count"   : 130,
+        "nick"              : 64,
+        "profile_image_url" : 23,
+        "description"       : 66,
+        "location"          : 64,
+        "url"               : 23,
+        "clock"             : 32
     },
 
     "TREND" : {
-        "url": "term_23"
+        "url": 23
     },
 
     "CAL" : {
-        "days": "term_64",
+        "days": 64,
         "today": "light_green"
     },
 
     "GROUP" : {
-        "name": "term_64",
-        "member": "term_130",
-        "subscriber": "term_32",
-        "mode": "term_164",
-        "description": "term_66",
-        "clock": "term_32"
+        "name": 64,
+        "member": 130,
+        "subscriber": 32,
+        "mode": 164,
+        "description": 66,
+        "clock": 32
     }
 }
index 9dcd03a..c090274 100644 (file)
         * light_magenta
         * light_cyan
         * white
-    and 256 terminal's colors from term_0 to term_255
+    and 256 terminal's colors from 0 to 255
     */
 
-    "DECORATED_NAME" : "term_103",
-    "CYCLE_COLOR" :["term_103","term_173","term_30","term_54","term_58","term_179","term_145"],
+    "DECORATED_NAME" : 103,
+    "CYCLE_COLOR" :[103,173,30,54,58,179,145],
     "TWEET" : {
-        "nick"      : "term_103",
-        "clock"     : "term_58",
-        "id"        : "term_173",
-        "favorited" : "term_54",
-        "rt"        : "term_145",
-        "link"      : "term_30",
+        "nick"      : 103,
+        "clock"     : 58,
+        "id"        : 173,
+        "favorited" : 54,
+        "rt"        : 145,
+        "link"      : 30,
         "keyword"   : "on_light_blue"
     },
 
     "MESSAGE" : {
-        "sender"    : "term_103",
-        "recipient" : "term_103",
-        "to"        : "term_54",
-        "clock"     : "term_58",
-        "id"        : "term_173"
+        "sender"    : 103,
+        "recipient" : 103,
+        "to"        : 54,
+        "clock"     : 58,
+        "id"        : 173
     },
 
     "PROFILE" : {
-        "statuses_count"    : "term_173",
-        "friends_count"     : "term_30",
-        "followers_count"   : "term_179",
-        "nick"              : "term_103",
-        "profile_image_url" : "term_30",
-        "description"       : "term_58",
-        "location"          : "term_54",
-        "url"               : "term_30",
-        "clock"             : "term_58"
+        "statuses_count"    : 173,
+        "friends_count"     : 30,
+        "followers_count"   : 179,
+        "nick"              : 103,
+        "profile_image_url" : 30,
+        "description"       : 58,
+        "location"          : 54,
+        "url"               : 30,
+        "clock"             : 58
     },
 
     "TREND" : {
-        "url": "term_30"
+        "url": 30
     },
 
     "CAL" : {
-        "days": "term_103",
+        "days": 103,
         "today": "on_light_blue"
     },
 
     "GROUP" : {
-        "name": "term_103",
-        "member": "term_179",
-        "subscriber": "term_30",
-        "mode": "term_54",
-        "description": "term_58",
-        "clock": "term_173"
+        "name": 103,
+        "member": 179,
+        "subscriber": 30,
+        "mode": 54,
+        "description": 58,
+        "clock": 173
     }
 }
index a24ce03..0abdede 100644 (file)
@@ -24,8 +24,8 @@ def init_cycle():
     Init the cycle
     """
     colors_shuffle = [globals()[i.encode('utf8')]
-                      if not i.startswith('term_')
-                      else term_color(int(i[5:]))
+                      if not str(i).isdigit()
+                      else term_color(int(i))
                       for i in c['CYCLE_COLOR']]
     return itertools.cycle(colors_shuffle)
 g['cyc'] = init_cycle()
@@ -45,8 +45,8 @@ def order_rainbow(s):
     Print a string with ordered color with each character
     """
     colors_shuffle = [globals()[i.encode('utf8')]
-                      if not i.startswith('term_')
-                      else term_color(int(i[5:]))
+                      if not str(i).isdigit()
+                      else term_color(int(i))
                       for i in c['CYCLE_COLOR']]
     colored = [colors_shuffle[i % 7](s[i]) for i in xrange(len(s))]
     return ''.join(colored)
@@ -57,8 +57,8 @@ def random_rainbow(s):
     Print a string with random color with each character
     """
     colors_shuffle = [globals()[i.encode('utf8')]
-                      if not i.startswith('term_')
-                      else term_color(int(i[5:]))
+                      if not str(i).isdigit()
+                      else term_color(int(i))
                       for i in c['CYCLE_COLOR']]
     colored = [random.choice(colors_shuffle)(i) for i in s]
     return ''.join(colored)
@@ -135,8 +135,8 @@ def color_func(func_name):
     """
     Call color function base on name
     """
-    if func_name.startswith('term_') and func_name[5:].isdigit():
-        return term_color(int(func_name[5:]))
+    if str(func_name).isdigit():
+        return term_color(int(func_name))
     return globals()[func_name]
 
 
index 2e7a14d..1448f17 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
 import os, sys
 
 # Bumped version
-version = '0.3.6'
+version = '0.3.7'
 
 # Require
 install_requires = [
index 51fb321..2916402 100644 (file)
--- a/theme.md
+++ b/theme.md
@@ -24,44 +24,44 @@ Examples are available in
 
 ```json
 {
-    "DECORATED_NAME" : "term_198",
-    "CYCLE_COLOR" :["term_198","term_57","term_166","term_50","term_179","term_74","term_112"],
+    "DECORATED_NAME" : 198,
+    "CYCLE_COLOR" :[198,57,166,50,179,74,112],
     "TWEET" : {
-        "nick"      : "term_112",
-        "clock"     : "term_57",
-        "id"        : "term_166",
-        "favourite" : "term_50",
-        "rt"        : "term_179",
-        "link"      : "term_74",
+        "nick"      : 112,
+        "clock"     : 57,
+        "id"        : 166,
+        "favourite" : 50,
+        "rt"        : 179,
+        "link"      : 74,
         "keyword"   : "on_light_green"
     },
 
     "MESSAGE" : {
-        "sender"    : "term_112",
-        "recipient" : "term_112",
-        "to"        : "term_50",
-        "clock"     : "term_57",
-        "id"        : "term_166"
+        "sender"    : 112,
+        "recipient" : 112,
+        "to"        : 50,
+        "clock"     : 57,
+        "id"        : 166
     },
 
     "PROFILE" : {
-        "statuses_count"    : "term_112",
-        "friends_count"     : "term_198",
-        "followers_count"   : "term_57",
-        "nick"              : "term_198",
-        "profile_image_url" : "term_74",
-        "description"       : "term_166",
-        "location"          : "term_112",
-        "url"               : "term_74",
-        "clock"             : "term_57"
+        "statuses_count"    : 112,
+        "friends_count"     : 198,
+        "followers_count"   : 57,
+        "nick"              : 198,
+        "profile_image_url" : 74,
+        "description"       : 166,
+        "location"          : 112,
+        "url"               : 74,
+        "clock"             : 57
     },
 
     "TREND" : {
-        "url": "term_74"
+        "url": 74
     },
-    
+
     "CAL" : {
-        "days": "term_57",
+        "days": 57,
         "today": "on_light_blue"
     }
 }
@@ -89,7 +89,7 @@ There are 16 basic colors:
 
 These colors will be enough for almost terminals.
 But if your terminal can support 256 colors (check your `$TERM` variable!),
-you can even use `term_0` to `term_255` as the example above.
+you can even use 0 to 255 as the example above.
 
 There are also background highlight colors like:
   * on_default