Fish library that streamlines ANSI formatting used in the terminal
I was tired of the unintuitive, repetitive, vague, limited (set_color --<switches> color) text (set_color --reset) syntax, and so was born a library to generate Fish help-texts: fish-helpText.
While this covered the most common usecase, fish-helpText isn't the only format to create help texts, and help-texts is not the only place where ANSI formatting is used.
I soon realized the need of something universal — this library. It can do everything set_color can (and more), but much more intuitively1, in a way that feels natural.
- No repetition: You don't have to call 3 commands or perform command substitutions just to be able to format something — that too in a ugly way. No echo calls, no color resets, it's all built-in.
- Sub-commands: everything here is a sub-command; this library is for formatting, not "coloring". Everything is treated equally, not hidden behind repetitive switches.
Note
set_color --background=cyan; echo skyFoo; set_color --reset → format background cyan 'skyFoo'
- Color Selection: Instead of digging through colors and their variants — all represented the same way, you simply pick the color, and shade it with flags.
Note
echo (set_color brgreen)leaf(set_color --reset) → format text color --bright green 'leaf'
Important
See the documentation for usage and installation
Footnotes
-
You cannot (uniformally) transform unknown continous existing unformatted data-streams — an edge case — something I have never seen happening ↩