Sha256: 5afb8d5735970f6661e6187e5242fc88c745f14011605922c2b3183709e3be44

Contents?: true

Size: 466 Bytes

Versions: 2

Compression:

Stored size: 466 Bytes

Contents

module Vedeu
  class Background < ColourTranslator

    private

    def named
      ["\e[", background_codes[colour], "m"].join
    end

    def numbered
      ["\e[48;5;", css_to_numbered, "m"].join
    end

    def rgb
      if Terminal.colour_mode == 16777216
        sprintf("\e[48;2;%s;%s;%sm", *css_to_rgb)

      else
        numbered

      end
    end

    def background_codes
      codes.inject({}){ |h, (k, v)| h.merge(k => v + 10) }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.1.17 lib/vedeu/models/attributes/background.rb
vedeu-0.1.16 lib/vedeu/models/attributes/background.rb