Live data from Hacker News

How to choose colors for your CLI applications (2023)

blog.xoria.org

41–50 of 103 posts

Re: How to choose colors for your CLI applications (2023)

#41

Earlier quoted context omitted.

CLI apps can detect the background color of the terminal, and determine contrasting colors accordingly.

They can? Is this a recent thing? I remember wanting to detect the background colour years ago, and not finding any way to do it.

It's not recent, and most terminals support it. You send an escape sequence to the terminal, and get back a sequence that tells you the exact background color.

Re: How to choose colors for your CLI applications (2023)

#42
post #35
post #33

Earlier quoted context omitted.

>Every good terminal emulator lets you set custom palettes Not differently for each program's output .

Which is a good reason to stick with the de-facto standard of red for bad and green for good.

unless you're colour blind

Re: How to choose colors for your CLI applications (2023)

#43

Use only default (white/black), red for bad, green for good. If you need more than that, like vim or whatever, then maybe a 'fullscreen' TUI is better, with a specified background and foreground. For CLI tools, I'm not sure if I prefer more colours. The CSS to make the terminals look like iTerm was smooth, to the point I read them as screenshots.

Color is cultural. Red is associated with good in China

Re: How to choose colors for your CLI applications (2023)

#45
Colourful terminals are so useful. I have mine colour coded according to the working directory depending on the project. So I can see which terminal is associated with which project even if there are twenty terminals open. The scripts are even in my servers so when I ssh in to them it changes colour as well.

https://michael.mior.ca/blog/coloured-ssh-terminals/

Re: How to choose colors for your CLI applications (2023)

#46

Use only default (white/black), red for bad, green for good. If you need more than that, like vim or whatever, then maybe a 'fullscreen' TUI is better, with a specified background and foreground. For CLI tools, I'm not sure if I prefer more colours. The CSS to make the terminals look like iTerm was smooth, to the point I read them as screenshots.

Color is cultural. Red is associated with good in China

Context here matters, red finds its way into Chinese forbidden or warning signs quite often.

Re: How to choose colors for your CLI applications (2023)

#47
Interesting analysis, but perhaps it warrants a different conclusion: it's almost impossible to please everyone in this case. The resulting colours seem of some utility, but if you intend to make something more interesting you're probably annoy some (potentially large) group, in the case of legacy terminal coloring.

Re: How to choose colors for your CLI applications (2023)

#48

I 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 dislike when devs only try to detect if it’s a tty, then enable all their gimmicks without even providing a flag. Not everything is xterm-256color.

Re: How to choose colors for your CLI applications (2023)

#49
I used solarized since it came out but I dropped it some years back. I don’t think I can use it for dark mode. It’s too washed out and dull compared to light mode which is what I used to use it with. I just use whatever VS Code or VIM gives me as a dark mode and it’s usually better.

Re: How to choose colors for your CLI applications (2023)

#50
post #35

Earlier quoted context omitted.

Which is a good reason to stick with the de-facto standard of red for bad and green for good.

unless you're colour blind

If you're color blind, you change the palette in your terminal emulator so "red" and "green" become different colors you can distinguish. It even works for rarer forms of color blindness. This works best when people follow the de-facto standard.
Post reply on HN