How to choose colors for your CLI applications (2023)
91–100 of 103 posts
Re: How to choose colors for your CLI applications (2023)
#92Earlier quoted context omitted.
More importantly, dont use color as sole source of information. Strikethrough, emoji or ok / bad can also be used.
Emojis aren't 7-bit clean. They're hard to type. They don't mean things the same way words do. `foo | grep -i error` communicates intent better than `foo | grep :-/` or whatever goofy hieroglyph someone chose instead of, like, a word with clearly defined meaning.
Re: How to choose colors for your CLI applications (2023)
#93As long as you respect the NO_COLOR variable, it will work for me. https://no-color.org/
Re: How to choose colors for your CLI applications (2023)
#94I made the "Aardvark Blue" a while back[1] to solve some of the problems that most color schemes have. The goal of this theme is that: - colors are fairly natural - background and black are distinct - grays are naturally ordered avoiding full black - light and dark colors are distinct from each other - all colors look good on background, black, dark gray, gray, white We use this for all the screenshots on https://rat…
Funny thing, those are not "the usual places" I've ever heard of, and I care somewhat about color schemes. Each of us lives in our own bubble... (my bubble is not iterm2 and not windows)
"Terminal, Konsole, PuTTY, Xresources, XRDB, Remmina, Termite, XFCE, Tilda, FreeBSD VT, Terminator, Kitty, MobaXterm, LXTerminal, Microsoft's Windows Terminal, Visual Studio, Alacritty, Ghostty, and many more."
You may have used data from it without knowing about it.
Re: How to choose colors for your CLI applications (2023)
#95I really wish you wouldn't. All the rinky dink colors and animations screw with the CLI output when you don't correctly detect whether the user's running the app interactively. Keep it plain text. Regular, old, boring output is good.
Big blocks of text are difficult to parse
Re: How to choose colors for your CLI applications (2023)
#96I really wish you wouldn't. All the rinky dink colors and animations screw with the CLI output when you don't correctly detect whether the user's running the app interactively. Keep it plain text. Regular, old, boring output is good.
I agree. So many TUIs from webshit devs don't even bother to call isatty, let alone check terminfo to see if ANSI escape codes are even valid for this terminal. But modern open source subscribes to Mao's Continuous Revolution Theory. Calls for some measure of stability and sanity are usually dismissed with some form of the argument "awwww, is poor diddums afwaid of a widdle change?" Or in this case, "still using vi o…
Re: How to choose colors for your CLI applications (2023)
#97Earlier quoted context omitted.
Funny thing, those are not "the usual places" I've ever heard of, and I care somewhat about color schemes. Each of us lives in our own bubble... (my bubble is not iterm2 and not windows)
iterm2colorschemes is a source for various other tools as it ports out to "Terminal, Konsole, PuTTY, Xresources, XRDB, Remmina, Termite, XFCE, Tilda, FreeBSD VT, Terminator, Kitty, MobaXterm, LXTerminal, Microsoft's Windows Terminal, Visual Studio, Alacritty, Ghostty, and many more." You may have used data from it without knowing about it.
Plausible!
Re: How to choose colors for your CLI applications (2023)
#98Earlier quoted context omitted.
iterm2colorschemes is a source for various other tools as it ports out to "Terminal, Konsole, PuTTY, Xresources, XRDB, Remmina, Termite, XFCE, Tilda, FreeBSD VT, Terminator, Kitty, MobaXterm, LXTerminal, Microsoft's Windows Terminal, Visual Studio, Alacritty, Ghostty, and many more." You may have used data from it without knowing about it.
> You may have used data from it without knowing about it. Plausible!
Re: How to choose colors for your CLI applications (2023)
#99Re: How to choose colors for your CLI applications (2023)
#100If you want a quick easy way to add some colors to your own shell scripts: export STDOUT_COLOR_START='[34m' export STDOUT_COLOR_STOP='[0m' export STDERR_COLOR_START='[31m' export STDERR_COLOR_STOP='[0m' In your shell script: print_stdout() { printf %s%s%s\\n "${STDOUT_COLOR_START:-}" "$*" "${STDOUT_COLOR_STOP:-}" } print_stderr() { >&2 printf %s%s%s\\n "${STDERR_COLOR_START:-}" "$*" "${STDERR_COLOR_STOP:-}" } Sou…
1. That script's color check doesn't check that the output is a terminal. Also test tty -s 2. Don't hardcode escape sequences. Use (e.g.) export STDOUT_COLOR_START="`tput setaf 4`".
For color operands, I use raw escape codes because I aim for POSIX compatibility. If I'm working on something that needs more capabilities then I switch to a more powerful programming language e.g. python, rust, etc.
As far as I understand, POSIX tput defines some terminal operands (clear, init, reset, etc.) but not color operands (setaf, setab, sgr0, etc.).