Class: Vedeu::Foreground Private

Inherits:
ColourTranslator show all
Defined in:
lib/vedeu/models/attributes/foreground.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The class represents one half (the other, can be found at Background) of a terminal colour escape sequence.

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Vedeu::ColourTranslator

Instance Method Details

#foreground_codesHash (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Produces the foreground named colour escape sequence hash from ColourTranslator#codes



40
41
42
# File 'lib/vedeu/models/attributes/foreground.rb', line 40

def foreground_codes
  codes
end

#namedString (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/vedeu/models/attributes/foreground.rb', line 13

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

#numberedString (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/vedeu/models/attributes/foreground.rb', line 19

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

#rgbString (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
28
29
30
31
32
33
# File 'lib/vedeu/models/attributes/foreground.rb', line 25

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

  else
    numbered

  end
end