Sha256: aac258715f17a88a152220fd07723b9b9a5eabb11a735f3cdc57df9a3e8bf006

Contents?: true

Size: 419 Bytes

Versions: 2

Compression:

Stored size: 419 Bytes

Contents

module Vedeu
  class Foreground < ColourTranslator

    private

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

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

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

      else
        numbered

      end
    end

    def foreground_codes
      codes
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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