4 ms·
Additional suggestions: * Respect the user's default foreground and background color. Don't change them without good reason. * If you use colors, make them l
by neilv 2y ago
Additional suggestions:
* Respect the user's default foreground and background color. Don't change them without good reason.
* If you use colors, make them legible regardless of what the default background and foreground colors are, and regardless of the terminal's color map.
* Don't use color as the only indication of something. The user's terminal might not display it, and it probably won't be preserved in copy&paste into notes.
* Use emoji only judiciously, if at all. Similar with gratuitous non-ASCII characters. It doesn't display everywhere, it doesn't paste well everywhere, and emoji can be a bit much when copy&pasted into some notes.
* In a scrolling (non-full-screen) stdout-ish output, don't delete important information that you showed temporarily. For example, hiding warnings or filenames compiled, to display a green checkmark for done. For another example, clearing the screen of Web app build information (including package security warnings!), to display a message that it's running in dev mode, is also not wanted. People might want to see that information, or copy&paste it into notes.
* If you went full angry fruit salad with your command line program, because it's your baby, and you're having fun hamming it up, that's fine, but please provide an easy preference setting for people to opt out of that. Your program is probably only one of many things on user's workstation display, where other programs might be using color and visuals more meaningfully, so animated throbbing red explosions for the code reformatter is a bit much.
- deleted 2y ago[deleted]
- hatthew 2y agoAs the article explicitly stated, these are descriptive not prescriptive rules. They're things that you can generally assume all terminal programs already follow.
- neilv 2y agoThe ones I listed were mostly descriptive, until recent years.
- teddyh 2y ago> please provide an easy preference setting for people to opt out of that. There is some effort to standardize this: <https://bixense.com/clicolors/ https://bixense.com/clicolors/>
- rodgerd 2y ago> * Don't use color as the only indication of something. The user's terminal might not display it The user may be colour-blind (30% of the population). The user may be completely blind and relying on a screen reader.
- Sharlin 2y ago30%? As far as I know, about 10% of male population has red-green deficiency, in females it's much rarer, and and all the other forms of colorblindness are very rare regardless of sex.
- patmcc 2y agoColourblindness is <10% of the population. But yes, quite right it's not a good idea to rely on colour as the sole indication of something important.
- Terr_ 2y ago> Use emoji only judiciously, if at all. That reminds me of an incredibly annoying bug I encountered a few years ago involving Docker. One of the scripts being run was outputting emoji to STDOUT, and this was causing the interactive terminal to crash and thus the container to exit. (This issue [0] has error-strings and simple repro tests.) I'm not sure if the root cause ever got fixed, but I (and many others) ended up making PRs for various open-source projects, to grudgingly implement workarounds that compromised their original artistic vision. :p [0] https://github.com/docker-archive/toolbox/issues/695 https://github.com/docker-archive/toolbox/issues/695
- Cpoll 2y agoNit: ┐ isn't emoji. It's a box drawing character, and they've been around in one form or another since at least the 80s. The modern form has been part of Unicode from (nearly?) the beginning. In any case, the character itself is unrelated to the bug. As someone pointed out in the bug thread, certain Cyrillic strings will also cause it.
- rascul 2y ago> * If you use colors, make them legible regardless of what the default background and foreground colors are, and regardless of the terminal's color map. This is kind of impossible. One can potentially provide for customized colors, though.
- ratorx 2y agoYou can delegate the choice to the terminal by using ANSI color codes [1]. Then the onus is on the user/terminal developer to make sure the colors they’ve configured (or the defaults provided) are reasonable. A downside of this is that it is quite restrictive, there are only like 8 colors. EDIT: I missed the “regardless of the color map” bit, that is a bit unreasonable. Either you trust the terminal emulator or don’t. I think trying to have it both ways is too much. [1]: https://gist.github.com/JBlond/2fea43a3049b38287e5e9cefc87b2124 https://gist.github.com/JBlond/2fea43a3049b38287e5e9cefc87b2...
- neilv 2y agoFor example, I've seen a program that sets foreground color to a symbolic (not RGB value) yellow, and doesn't set background. While that combination might be legible on some terminals, it's definitely not on all of them. Don't assume that the user's terminal's color map makes all combinations legible.
- Vegenoid 2y agoWhat combinations can be assumed to be legible? I think if a terminal user has their colors configured so that some of the 8 ASCII colors aren’t legible on their background, that’s on them, with the exception of white and black. It seems like the only way to satisfy your ask is to not use color at all.
- neilv 2y agoThe default configurations of most terminals includes illegible color combinations. So I think it's not on every user to somehow design optimal color palette settings on their computer that work in all combinations (if they even can), but rather on the developers of software not to say "Hey, I bet every yellow would be legible on white" or "Yolo, I bet yellow is legible on every background, so I'm just going to set this foreground to yellow and not set background at all."
- linhns 2y ago> Use emoji only judiciously, if at all. Similar with gratuitous non-ASCII characters. This deserves to be highlighted more. Nowadays some authors keep assuming users use a patched font and build their tools with that in mind, thus hampering ease of use significantly.
- _kst_ 2y ago> Don't use color as the only indication of something. The user's terminal might not display it, and it probably won't be preserved in copy&paste into notes. And some of us choose to disable color by default. (Yes, I'm old-fashioned.)