Sha256: df095702103360e546c1e29d383381a6ceb5e349959f7e9d02ed4a5e75416f98

Contents?: true

Size: 518 Bytes

Versions: 5

Compression:

Stored size: 518 Bytes

Contents

module PandaPal
  module ConsoleHelpers
    extend self

    COLORS = {
      "black" => 0,
      "red" => 1,
      "green" => 2,
      "yellow" => 3,
      "blue" => 4,
      "purple" => 5,
      "magenta" => 5,
      "cyan" => 6,
      "white" => 7
    }.freeze

    COLORS.each_pair do |color, value|
      define_method color do |text|
        "\033[0;#{30 + value}m#{text}\033[0m"
      end

      define_method "bright_#{color}" do |text|
        "\033[1;#{30 + value}m#{text}\033[0m"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
panda_pal-5.8.5 lib/panda_pal/helpers/console_helpers.rb
panda_pal-5.8.4 lib/panda_pal/helpers/console_helpers.rb
panda_pal-5.8.3 lib/panda_pal/helpers/console_helpers.rb
panda_pal-5.8.2 lib/panda_pal/helpers/console_helpers.rb
panda_pal-5.8.1 lib/panda_pal/helpers/console_helpers.rb