Sha256: 247409351cb0f98470d7b5b01905b381945d5408eee790fddcb5d8ab4ca991d3

Contents?: true

Size: 417 Bytes

Versions: 34

Compression:

Stored size: 417 Bytes

Contents

module Timber
  class CLI
    class IO
      module ANSI
        def self.colorize(text, color)
          return text if Gem.win_platform?

          code =
            case color
            when :blue then 34
            when :red then 31
            when :green then 32
            when :yellow then 33
            else 0
            end

          "\e[#{code}m#{text}\e[0m"
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
timber-2.1.7 lib/timber/cli/io/ansi.rb
timber-2.1.6 lib/timber/cli/io/ansi.rb
timber-2.1.5 lib/timber/cli/io/ansi.rb
timber-2.1.4 lib/timber/cli/io/ansi.rb
timber-2.1.3 lib/timber/cli/io/ansi.rb
timber-2.1.2 lib/timber/cli/io/ansi.rb
timber-2.1.1 lib/timber/cli/io/ansi.rb
timber-2.1.0 lib/timber/cli/io/ansi.rb
timber-2.1.0.rc6 lib/timber/cli/io/ansi.rb
timber-2.1.0.rc5 lib/timber/cli/io/ansi.rb
timber-2.1.0.rc4 lib/timber/cli/io/ansi.rb
timber-2.1.0.rc3 lib/timber/cli/io/ansi.rb
timber-2.1.0.rc2 lib/timber/cli/io/ansi.rb
timber-2.1.0.rc1 lib/timber/cli/io/ansi.rb