aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/screen_text_color.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
committerRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
commitedd89902036bde18c91031470e19c871a182cf6d (patch)
tree1269e7b1660aa64896fc21768002e837233c2c24 /lib/sisu/v5/screen_text_color.rb
parentv4 v5: version & changelog (diff)
v5: options & downstream, more use of opt.act instead of opt.cmd
* opt.act.*.set==:on instead of opt.cmd =~/\S/
Diffstat (limited to 'lib/sisu/v5/screen_text_color.rb')
-rw-r--r--lib/sisu/v5/screen_text_color.rb19
1 files changed, 5 insertions, 14 deletions
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