Sha256: 1fe2e3ae809953e0f29821491071d721ee624c87abc28a0172c688837ed75c7a
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module Vedeu # The class represents one half (the other, can be found at # {Vedeu::Foreground}) of a terminal colour escape sequence. # # @api private class Background < ColourTranslator private # Returns an escape sequence for a named background colour. # # Valid names are: `:black`, `:red`, `:green`, `:yellow`, `:blue`, # `:magenta`, `:cyan`, `:white` and `:default`. # # @return [String] def named ["\e[", background_codes[colour], 'm'].join end # @return [String] def numbered ["\e[48;5;", css_to_numbered, 'm'].join end # @return [String] def rgb if Configuration.colour_mode == 16777216 sprintf("\e[48;2;%s;%s;%sm", *css_to_rgb) else numbered end end # Produces the background named colour escape sequence hash from the # foreground escape sequence hash. # # @return [Hash] def background_codes codes.inject({}){ |h, (k, v)| h.merge(k => v + 10) } end end # Background end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.2.4 | lib/vedeu/models/background.rb |