require 'simplecolor/version' require 'simplecolor/colors' #Usage: # #@example # class Foo # include SimpleColor::Mixin # def to_str # ... # end # end # foo=Foo.new() # foo.color(:red) #after SimpleColor.mix_in_string, one can do #`"blue".color(:blue,:bold)` module SimpleColor # The Colorer module handle all color outputs module Colorer extend self WrongColor=Class.new(StandardError) def color_attributes(*args, mode: :text) accu=[] buffer="" flush=lambda {r=accu.join(";"); accu=[]; r.empty? || r="\e["+r+"m"; buffer<