Sha256: 48f850695036a479ebd0c7698902b69df93434c0e3ffcc08c35c760b109d2876

Contents?: true

Size: 888 Bytes

Versions: 1

Compression:

Stored size: 888 Bytes

Contents

module Vedeu

  module Colours

    # The class represents one half (the other, can be found at
    # {Vedeu::Colours::Background}) of a terminal colour escape
    # sequence.
    #
    # @api private
    #
    class Foreground < Vedeu::Colours::Translator

      # @return [Boolean]
      def foreground?
        present?(to_s)
      end

      private

      # @return [String]
      def prefix
        "\e[38;".freeze
      end

      # Returns an escape sequence for a named colour.
      #
      # @note
      #   Valid names can be found at
      #   {Vedeu::EscapeSequences::Esc#valid_codes}
      #
      # @return [String]
      def named_code
        Vedeu::EscapeSequences::Esc.foreground_colour(colour)
      end

      # @return [Vedeu::Colours::Foregrounds]
      def repository
        Vedeu.foreground_colours
      end

    end # Foreground

  end # Colours

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.8.0 lib/vedeu/colours/foreground.rb