Sha256: 8576b60ac437a6a2eecfff4403f6801cc4efdd0cc76614f3b61d76ff482b81dc

Contents?: true

Size: 836 Bytes

Versions: 19

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

module Karafka
  module Helpers
    # Simple wrapper for adding colors to strings
    module Colorize
      # @param string [String] string we want to have in green
      # @return [String] green string
      def green(string)
        "\033[0;32m#{string}\033[0m"
      end

      # @param string [String] string we want to have in red
      # @return [String] red string
      def red(string)
        "\033[0;31m#{string}\033[0m"
      end

      # @param string [String] string we want to have in yellow
      # @return [String] yellow string
      def yellow(string)
        "\033[1;33m#{string}\033[0m"
      end

      # @param string [String] string we want to have in grey
      # @return [String] grey string
      def grey(string)
        "\e[38;5;244m#{string}\e[0m"
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
karafka-2.4.17 lib/karafka/helpers/colorize.rb
karafka-2.4.16 lib/karafka/helpers/colorize.rb
karafka-2.4.15 lib/karafka/helpers/colorize.rb
karafka-2.4.14 lib/karafka/helpers/colorize.rb
karafka-2.4.13 lib/karafka/helpers/colorize.rb
karafka-2.4.12 lib/karafka/helpers/colorize.rb
karafka-2.4.11 lib/karafka/helpers/colorize.rb
karafka-2.4.10 lib/karafka/helpers/colorize.rb
karafka-2.4.9 lib/karafka/helpers/colorize.rb
karafka-2.4.8 lib/karafka/helpers/colorize.rb
karafka-2.4.7 lib/karafka/helpers/colorize.rb
karafka-2.4.6 lib/karafka/helpers/colorize.rb
karafka-2.4.5 lib/karafka/helpers/colorize.rb
karafka-2.4.4 lib/karafka/helpers/colorize.rb
karafka-2.4.3 lib/karafka/helpers/colorize.rb
karafka-2.4.0 lib/karafka/helpers/colorize.rb
karafka-2.4.0.rc1 lib/karafka/helpers/colorize.rb
karafka-2.4.0.beta2 lib/karafka/helpers/colorize.rb
karafka-2.4.0.beta1 lib/karafka/helpers/colorize.rb