From 2dcb16c5658eb0ff25d1e2bad91d7050508f37d8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 19 Apr 2011 21:24:24 -0400 Subject: v3: screen_text_color (ansi colors) touched, consider reviewing later --- data/doc/sisu/CHANGELOG_v3 | 2 + lib/sisu/v3/screen_text_color.rb | 81 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 26c48d9f..39ad8855 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.7.orig.tar.gz * frugal, cterm colors ... my term oddly has 8 colors plus 242 for dark grey possibly more but odd numbers to set + * screen_text_color (ansi colors) touched, consider reviewing later + %% 3.0.6.orig.tar.gz (2011-03-30:13/3) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.6-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.6.orig.tar.gz diff --git a/lib/sisu/v3/screen_text_color.rb b/lib/sisu/v3/screen_text_color.rb index d4855ccd..3ad5b09d 100644 --- a/lib/sisu/v3/screen_text_color.rb +++ b/lib/sisu/v3/screen_text_color.rb @@ -58,7 +58,7 @@ =end module SiSU_Screen class Color - attr_accessor :off,:marker,:bold,:underline,:invert,:darkgrey_hi,:grey_hi,:pink_hi,:fuschia_hi,:red_hi,:orange_hi,:yellow_hi,:brown_hi,:lightgreen_hi,:green_hi,:cyan_hi,:blue_hi,:navy_hi,:white,:grey,:pink,:fuschia,:ruby,:red,:orange,:yellow,:brown,:green,:darkgreen,:cyan,:blue,:navy,:black + attr_accessor :off,:marker,:bold,:underline,:invert,:darkgrey_hi,:grey_hi,:pink_hi,:fuschia_hi,:red_hi,:orange_hi,:yellow_hi,:brown_hi,:lightgreen_hi,:green_hi,:cyan_hi,:blue_hi,:navy_hi,:white,:white_bold,:grey,:pink,:fuschia,:ruby,:red,:orange,:yellow,:brown,:green,:darkgreen,:cyan,:blue,:navy,:black def initialize(&block) instance_eval &block end @@ -85,12 +85,13 @@ module SiSU_Screen end @cX=@@cX= unless @use_color Color.new do - self.off=self.white=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuschia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuschia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black='' + self.off=self.white=self.white_bold=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuschia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuschia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black='' end else #default set to colors on Color.new do self.off = "\033[0m" - self.white = "\033[0m" + self.white = "\033[37m" + self.white_bold = "\033[1m" self.marker = "\033[42m" self.bold = "\033[1m" self.underline = "\033[4m" @@ -127,7 +128,7 @@ module SiSU_Screen end def colors 0.upto(109) {|i| print "\033[#{i}m 33[#{i}m \033[m"} - puts '' + puts '' end def color case @color_instruct @@ -412,3 +413,75 @@ module SiSU_Screen end end __END__ + Color.new do + self.off = "\033[0m" + self.white = "\033[37m" + self.white_bold = "\033[1m" + self.marker = "\033[42m" + self.bold = "\033[1m" + self.underline = "\033[4m" + self.invert = "\033[7m" + self.darkgrey_hi = "\033[100m" + self.grey_hi = "\033[47m" + self.pink_hi = "\033[105m" + self.fuschia_hi = "\033[45m" + self.red_hi = "\033[41m" + self.orange_hi = "\033[101m" + self.yellow_hi = "\033[103m" + self.brown_hi = "\033[43m" + self.lightgreen_hi = "\033[102m" + self.green_hi = "\033[42m" + self.cyan_hi = "\033[106m" + self.blue_hi = "\033[104m" + self.navy_hi = "\033[44m" + self.grey = "\033[90m" + self.pink = "\033[95m" + self.fuschia = "\033[35m" + self.ruby = "\033[31m" + self.red = "\033[91m" #check + self.orange = "\033[91m" + self.yellow = "\033[93m" + self.brown = "\033[33m" + self.green = "\033[92m" + self.darkgreen = "\033[32m" + self.cyan = "\033[36m" + self.blue = "\033[94m" + self.navy = "\033[34m" + self.black = "\033[30m" + end +# fewer colors + Color.new do + self.off = "\033[0m" + self.white = "\033[0m" + self.marker = "\033[42m" + self.bold = "\033[1m" + self.underline = "\033[4m" + self.invert = "\033[7m" + self.darkgrey_hi = "\033[100m" + self.grey_hi = "\033[47m" + self.pink_hi = "\033[105m" + self.fuschia_hi = "\033[45m" + self.red_hi = "\033[41m" + self.orange_hi = "\033[101m" + self.yellow_hi = "\033[103m" + self.brown_hi = "\033[43m" + self.lightgreen_hi = "\033[102m" + self.green_hi = "\033[42m" + self.cyan_hi = "\033[106m" + self.blue_hi = "\033[104m" + self.navy_hi = "\033[44m" + self.grey = "\033[90m" + self.pink = "\033[95m" + self.fuschia = "\033[35m" + self.ruby = "\033[31m" + self.red = "\033[31m" #check + self.orange = "\033[91m" + self.yellow = "\033[33m" + self.brown = "\033[33m" + self.green = "\033[32m" + self.darkgreen = "\033[32m" + self.cyan = "\033[36m" + self.blue = "\033[34m" + self.navy = "\033[34m" + self.black = "\033[30m" + end -- cgit v1.2.3