Sha256: 4e113e65a0ad53bc3f5baec4a5e6147e3271a9af49f58581419e1309ed7347ab
Contents?: true
Size: 510 Bytes
Versions: 26
Compression:
Stored size: 510 Bytes
Contents
class ANSI def self.resolve_text( color, &block ) text = nil if block_given? text = block.call + reset end "\e[#{chart[color.to_sym]}m#{text}" end def self.reset "\e[0m" end def self.chart { black: 30, red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, white: 37 } end chart.keys.each do |color| define_singleton_method color do |&block| resolve_text color, &block end end end
Version data entries
26 entries across 26 versions & 2 rubygems