Color scheme currently in use during parsing.
Color scheme currently in use during parsing.
(apply-props rf)
Stateful transducer, apply it over the output of token-stream to know which styling should be applied over each piece of text.
The results are pairs consisting of a property map and a string.
Stateful transducer, apply it over the output of token-stream to know which styling should be applied over each piece of text. The results are pairs consisting of a property map and a string.
(chunk->hiccup [{:keys [foreground background bold] :as props} text])
(code->attrs code)
Given a CSI code, return a map of properties it sets. A value of nil
means
the property gets unset.
Given a CSI code, return a map of properties it sets. A value of `nil` means the property gets unset.
(color-24-bit [r g b])
(color-8-bit code)
Parse a "8-bit" color, given the code that follows on ESC[38;5;<code>m.
Parse a "8-bit" color, given the code that follows on ESC[38;5;<code>m.
Color schemes used in popular applications.
Color schemes used in popular applications.
(csi->attrs csi)
Given a CSI specifier, excluding ESC[ but including the final "m", convert it to a map of properties that it sets or unsets. Property values of nil indicate a reset/unset.
Given a CSI specifier, excluding ESC[ but including the final "m", convert it to a map of properties that it sets or unsets. Property values of nil indicate a reset/unset.
ASCII escape character (codepoint 27, hex 1b, octal 33).
ASCII escape character (codepoint 27, hex 1b, octal 33).
(get-color n)
(has-escape-char? s)
Efficient check to see if a string contains an escape character.
Efficient check to see if a string contains an escape character.
Transducer that consumes strings of input, and produces hiccup elements. Useful when dealing with streaming input, since it will carry over the 'terminal state'.
Transducer that consumes strings of input, and produces hiccup elements. Useful when dealing with streaming input, since it will carry over the 'terminal state'.
(next-csi s)
(next-csi s start)
(parse-color fg-or-bg [colorspace & more])
Handle CSI code 38 and 48, used to specify 8 or 24 bit colors. This may consume up to 5 codes in total (ESC [38;2;r;g;bm). Returns the map of properties that get set, and the remaining, unconsumed codes.
Handle CSI code 38 and 48, used to specify 8 or 24 bit colors. This may consume up to 5 codes in total (ESC [38;2;r;g;bm). Returns the map of properties that get set, and the remaining, unconsumed codes.
(parse-int s)
(rgb->css [_ r g b])
(str-scan pos s min max)
Starting at position pos, move forward as long as the characters at the current position are within the given range. Returns the new position.
Starting at position pos, move forward as long as the characters at the current position are within the given range. Returns the new position.
(str-split s sep)
Like clojure.string/split, but uses a single character instead of a regex, allowing for faster operation.
Like clojure.string/split, but uses a single character instead of a regex, allowing for faster operation.
(text->hiccup text)
Convenience function for the basic case where you have a string of terminal output and want to turn it into hiccup. Returns a seq of [:span] elements.
Convenience function for the basic case where you have a string of terminal output and want to turn it into hiccup. Returns a seq of [:span] elements.
(token-stream string)
Tokenize a string, whereby each CSI sequence gets transformed into a map of properties. The result is a vector of strings and maps.
Tokenize a string, whereby each CSI sequence gets transformed into a map of properties. The result is a vector of strings and maps.
(with-color-scheme name & body)
Execute code with the given color scheme active, name must be one of :vga :cmd :osx :putty :mirc :xterm :ubuntu. For finer control bind to color-scheme directly.
Execute code with the given color scheme active, name must be one of :vga :cmd :osx :putty :mirc :xterm :ubuntu. For finer control bind to *color-scheme* directly.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close