Sha256: 45cae5a9548f1f310e71f5ac4ed4ac975c015d0bf54280543012187669f42ecf

Contents?: true

Size: 925 Bytes

Versions: 19

Compression:

Stored size: 925 Bytes

Contents



	module Escseq
		Colors = [ 	:black,
					:red, 
					:green, 
					:yellow, 
					:blue, 
					:purple, 
					:cyan, 
					:white,
					:unknown,
					:default
				 ]
		Colors.each_with_index do |e, i|
			col = e.to_s
			capCol = e.to_s.capitalize
			eval %{
				#{capCol} = "\\x1b[#{i + 30}m"
				Bg#{capCol} = "\\x1b[#{i + 40}m"
				def #{col}
#					if STDOUT.tty?
						#{capCol} + self + Default
#					else
#						self
#					end
				end
				def bg#{capCol}
#					if STDOUT.tty?
						Bg#{capCol} + Black + self + Default + BgDefault
#					else
#						self
#					end
				end
				def self.#{col}
#					if STDOUT.tty?
						#{capCol} + self + Default
#					else
#						self
#					end
				end
				def self.bg#{capCol}
#					if STDOUT.tty?
						Bg#{capCol} + self + Default
#					else
#						self
#					end
				end
			}
		end
		module_function
		def beIncludedBy (klass)
			klass.__send__(:include, Escseq)
		end
	end



Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
YkLib-0.1.8.9 lib/Yk/escseq.rb
YkLib-0.1.8.8 lib/Yk/escseq.rb
YkLib-0.1.8.7 lib/Yk/escseq.rb
YkLib-0.1.8.6 lib/Yk/escseq.rb
YkLib-0.1.8.5 lib/Yk/escseq.rb
YkLib-0.1.8.4 lib/Yk/escseq.rb
YkLib-0.1.8.3 lib/Yk/escseq.rb
YkLib-0.1.8.2 lib/Yk/escseq.rb
YkLib-0.1.8.1 lib/Yk/escseq.rb
YkLib-0.1.8 lib/Yk/escseq.rb
YkLib-0.1.7.1 lib/Yk/escseq.rb
YkLib-0.1.7 lib/Yk/escseq.rb
YkLib-0.1.6 lib/Yk/escseq.rb
YkLib-0.1.5 lib/Yk/escseq.rb
YkLib-0.1.4 lib/Yk/escseq.rb
YkLib-0.1.3 lib/Yk/escseq.rb
YkLib-0.1.2 lib/Yk/escseq.rb
YkLib-0.1.1 lib/Yk/escseq.rb
YkLib-0.1.0 lib/YkLib/Yk/escseq.rb