From edd89902036bde18c91031470e19c871a182cf6d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 23 Oct 2013 23:40:45 -0400 Subject: v5: options & downstream, more use of opt.act instead of opt.cmd * opt.act.*.set==:on instead of opt.cmd =~/\S/ --- lib/sisu/v5/screen_text_color.rb | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'lib/sisu/v5/screen_text_color.rb') diff --git a/lib/sisu/v5/screen_text_color.rb b/lib/sisu/v5/screen_text_color.rb index 10ced907..4e4a319f 100644 --- a/lib/sisu/v5/screen_text_color.rb +++ b/lib/sisu/v5/screen_text_color.rb @@ -68,20 +68,11 @@ module SiSU_Screen end class Ansi < Color attr_reader :cX - def initialize(cmd,*txt) - @cmd,@txt=cmd,txt - @color_instruct=txt[0] - flag=SiSU_Env::InfoProcessingFlag.new - if cmd - #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off - @use_color=(flag.color) \ - ? ((cmd =~/c/) ? false : true) - : ((cmd =~/c/) ? true : false) - if cmd =~/k/ then @use_color=false # useful color off switch, however, k may be used for something else in future - end - else @use_color=false - end - @cX=@@cX= unless @use_color + def initialize(color_state,*txt) + @color_state,@txt=color_state,txt + @color_instruct=txt[0] #### + #flag=SiSU_Env::InfoProcessingFlag.new + @cX=@@cX=if color_state==:on Color.new do 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.fuchsia_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.fuchsia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black='' end -- cgit v1.2.3