From 37ae740ef2ad0b2a7f2af68d9116c1bc268cbe00 Mon Sep 17 00:00:00 2001 From: Vu Nhat Minh Date: Thu, 3 Jul 2014 17:34:47 +0900 Subject: [PATCH] term --- rainbowstream/colors.py | 2 +- rainbowstream/colorset/default.json | 2 +- rainbowstream/colorset/monokai.json | 52 ++++++++++++++--------------- rainbowstream/draw.py | 8 ++--- 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/rainbowstream/colors.py b/rainbowstream/colors.py index 159244d..95d34c3 100644 --- a/rainbowstream/colors.py +++ b/rainbowstream/colors.py @@ -11,7 +11,7 @@ def basic_color(code): return inner -def RGB(code): +def term_color(code): """ 256 colors supported """ diff --git a/rainbowstream/colorset/default.json b/rainbowstream/colorset/default.json index 5938650..593321a 100644 --- a/rainbowstream/colorset/default.json +++ b/rainbowstream/colorset/default.json @@ -40,7 +40,7 @@ * light_magenta * light_cyan * white - and 256 colors from RGB_0 to RGB_255 + and 256 colors from term_0 to term_255 Color code can be reference at http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html */ diff --git a/rainbowstream/colorset/monokai.json b/rainbowstream/colorset/monokai.json index a1ba750..06f508b 100644 --- a/rainbowstream/colorset/monokai.json +++ b/rainbowstream/colorset/monokai.json @@ -17,44 +17,42 @@ * light_magenta * light_cyan * white - and 256 colors from RGB_0 to RGB_255 - Color code can be reference at - http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html - */ + and 256 terminal's colors from term_0 to term_255 + */ - "DECORATED_NAME" : "RGB_198", - "CYCLE_COLOR" :["RGB_198","RGB_57","RGB_166","RGB_50","RGB_179","RGB_74","RGB_112"], + "DECORATED_NAME" : "term_198", + "CYCLE_COLOR" :["term_198","term_57","term_166","term_50","term_179","term_74","term_112"], "TWEET" : { - "nick" : "RGB_112", - "clock" : "RGB_57", - "id" : "RGB_166", - "favourite" : "RGB_50", - "rt" : "RGB_179", - "link" : "RGB_74", + "nick" : "term_112", + "clock" : "term_57", + "id" : "term_166", + "favourite" : "term_50", + "rt" : "term_179", + "link" : "term_74", "keyword" : "on_light_green" }, "MESSAGE" : { - "sender" : "RGB_112", - "recipient" : "RGB_112", - "to" : "RGB_50", - "clock" : "RGB_57", - "id" : "RGB_166" + "sender" : "term_112", + "recipient" : "term_112", + "to" : "term_50", + "clock" : "term_57", + "id" : "term_166" }, "PROFILE" : { - "statuses_count" : "RGB_112", - "friends_count" : "RGB_198", - "followers_count" : "RGB_57", - "nick" : "RGB_198", - "profile_image_url" : "RGB_74", - "description" : "RGB_166", - "location" : "RGB_112", - "url" : "RGB_74", - "clock" : "RGB_57" + "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" }, "TREND" : { - "url": "RGB_74" + "url": "term_74" } } \ No newline at end of file diff --git a/rainbowstream/draw.py b/rainbowstream/draw.py index a44450c..d25a3c9 100644 --- a/rainbowstream/draw.py +++ b/rainbowstream/draw.py @@ -24,8 +24,8 @@ def init_cycle(): Init the cycle """ colors_shuffle = [globals()[i.encode('utf8')] - if not i.startswith('RGB_') - else RGB(int(i[4:])) + if not i.startswith('term_') + else term_color(int(i[4:])) for i in c['CYCLE_COLOR']] return itertools.cycle(colors_shuffle) g['cyc'] = init_cycle() @@ -109,8 +109,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:])) + if pure.startswith('term_') and pure[4:].isdigit(): + return term_color(int(pure[4:])) return globals()[pure] -- 2.25.1