Sha256: da28850b19fedd5ee9487f056011f20a3f9ccdfaf686da45a9dd90803a16ee74
Contents?: true
Size: 1004 Bytes
Versions: 2
Compression:
Stored size: 1004 Bytes
Contents
require 'vedeu/configuration/configuration' require 'vedeu/output/translator' require 'vedeu/support/esc' module Vedeu # The class represents one half (the other, can be found at # {Vedeu::Background}) of a terminal colour escape sequence. # # @api private # class Foreground < Translator private # Returns an escape sequence for a named foreground colour. # # Valid names are: `:black`, `:red`, `:green`, `:yellow`, `:blue`, # `:magenta`, `:cyan`, `:white` and `:default`. # # @return [String] def named ["\e[", Esc.foreground_codes[colour], 'm'].join end # Returns an escape sequence. # # @return [String] def numbered ["\e[38;5;", css_to_numbered, 'm'].join end # Returns an escape sequence. # # @return [String] def rgb if Configuration.colour_mode == 16777216 sprintf("\e[38;2;%s;%s;%sm", *css_to_rgb) else numbered end end end # Foreground end # Vedeu
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.4.1 | lib/vedeu/output/foreground.rb |
vedeu-0.4.0 | lib/vedeu/output/foreground.rb |