| Class | Pastel::ColorParser |
| In: |
lib/pastel/color_parser.rb
|
| Parent: | Object |
Responsible for parsing color symbols out of text with color escapes
Used internally by {Color}.
@api private
| ESC | = | "\x1b".freeze |
| CSI | = | "\[".freeze |
Decide attribute name for ansi
@param [Integer] ansi
the ansi escape code
@return [Symbol]
@api private
Parse color escape sequences into a list of hashes corresponding to the color attributes being set by these sequences
@example
parse("\e[32mfoo\e[0m") # => [{colors: [:green], text: 'foo'}
@param [String] text
the text to parse for presence of color ansi codes
@return [Array[Hash[Symbol,String]]]
@api public