Sha256: 17f5c25c12523ebf8f172ef55b7b12b313636312eb7ddb122abf58edc8d4dc8c

Contents?: true

Size: 637 Bytes

Versions: 1

Compression:

Stored size: 637 Bytes

Contents

module Vedeu
  class Background < ColourTranslator

    private

    # @api private
    # @return [String]
    def named
      ["\e[", background_codes[colour], "m"].join
    end

    # @api private
    # @return [String]
    def numbered
      ["\e[48;5;", css_to_numbered, "m"].join
    end

    # @api private
    # @return [String]
    def rgb
      if Configuration.colour_mode == 16777216
        sprintf("\e[48;2;%s;%s;%sm", *css_to_rgb)

      else
        numbered

      end
    end

    # @api private
    # @return [Hash]
    def background_codes
      codes.inject({}){ |h, (k, v)| h.merge(k => v + 10) }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.1.18 lib/vedeu/models/attributes/background.rb