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.6.2 lib/timber/cli/io/ansi.rb
timber-2.6.1 lib/timber/cli/io/ansi.rb
timber-2.6.0 lib/timber/cli/io/ansi.rb
timber-2.6.0.pre.beta2 lib/timber/cli/io/ansi.rb
timber-2.6.0.pre.beta1 lib/timber/cli/io/ansi.rb
timber-2.5.1 lib/timber/cli/io/ansi.rb
timber-2.5.0 lib/timber/cli/io/ansi.rb
timber-2.4.0 lib/timber/cli/io/ansi.rb
timber-2.3.4 lib/timber/cli/io/ansi.rb
timber-2.3.3 lib/timber/cli/io/ansi.rb
timber-2.3.2 lib/timber/cli/io/ansi.rb
timber-2.3.1 lib/timber/cli/io/ansi.rb
timber-2.3.0 lib/timber/cli/io/ansi.rb
timber-2.2.3 lib/timber/cli/io/ansi.rb
timber-2.2.2 lib/timber/cli/io/ansi.rb
timber-2.2.1 lib/timber/cli/io/ansi.rb
timber-2.2.0 lib/timber/cli/io/ansi.rb
timber-2.1.10 lib/timber/cli/io/ansi.rb
timber-2.1.9 lib/timber/cli/io/ansi.rb
timber-2.1.8 lib/timber/cli/io/ansi.rb