How to Choose Colors for Your CLI Applications (2023)
by kruuuder on 1/29/2026, 2:49:08 PM
https://blog.xoria.org/terminal-colors/
Comments
by: layer8
As long as CLI programs stick to the 8 or 16 standard colors and refrain from setting background colors (inverse mode is fine), as well as from explicitly setting white or black as text color, everyone can reasonably configure their terminal colors so that everything is readable.<p>When going beyond that, the colors really need to be configurable on the application.
1/29/2026, 4:54:21 PM
by: tolciho
A confused user once stopped by, they had a blank terminal, so I showed them how to select all which revealed the helpfully black on black text. These days I compile colour support out of st, or set *colorMode:false for xterm. "But you can customize the colours" is a typical response, to which one might respond that one has grown weary of pushing that particular rock, and moreover one may be busy with other things at a drag-out monitor in a server room at three in the morning that has helpfully dark blue text on a black console, or worse if some high-minded expert has gone and rubbed the backside of a unicorn everywhere so that they may improve the "legibility".
1/29/2026, 5:51:53 PM
by: j4cobgarby
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.<p>The CSS to make the terminals look like iTerm was smooth, to the point I read them as screenshots.
1/29/2026, 3:20:53 PM
by: s_dev
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.<p><a href="https://michael.mior.ca/blog/coloured-ssh-terminals/" rel="nofollow">https://michael.mior.ca/blog/coloured-ssh-terminals/</a>
1/29/2026, 5:12:25 PM
by: red_admiral
There's an ever more basic rule: don't just make your text white (ANSI 37m) because you assume the terminal will have a dark background. Even white-on-black (37;40m), while usually readable, can stand out the wrong way if you assume that everyone is using dark mode.
1/29/2026, 4:09:49 PM
by: nateroling
I’ve bounced off of LazyGit multiple times because I never figured out how to make it play nice with a light theme terminal.<p>I haven’t used dark mode anything for years. I set my monitor so it’s roughly as bright, or slightly brighter than, a piece of white paper.<p>No more flash-bangs when some website doesn’t support dark mode.
1/29/2026, 6:32:09 PM
by: jammcq
I'm a bit color blind and it might be quite common to show errors in red but when the background is black, I can't see it at all.
1/29/2026, 4:58:23 PM
by: ori_b
As long as you respect the NO_COLOR variable, it will work for me.<p><a href="https://no-color.org/" rel="nofollow">https://no-color.org/</a>
1/29/2026, 5:31:20 PM
by: makapuf
I really think we should converge to semantic codes. By example Background is zero, standard is 7, positive / negative, highlight, colored1,2,3 .. with correct defaults, and let the user have a common 8 or 16 colors palette in the terminal for all textmode apps. Imagine having some kind of unified color themes in the terminal.
1/29/2026, 5:48:03 PM
by: jph
If you want a quick easy way to add some colors to your own shell scripts:<p><pre><code> export STDOUT_COLOR_START='[34m' export STDOUT_COLOR_STOP='[0m' export STDERR_COLOR_START='[31m' export STDERR_COLOR_STOP='[0m' </code></pre> In your shell script:<p><pre><code> 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:-}" } </code></pre> Source: <a href="https://github.com/sixarm/unix-shell-script-kit" rel="nofollow">https://github.com/sixarm/unix-shell-script-kit</a><p>The source also has functions for nocolor, and detecting a dumb terminal setup that doesn't use colors, etc.
1/29/2026, 5:36:17 PM
by: alias_neo
I recently spent several evenings re-working all of my colours across all of my computers and screens; terminals, IDEs, etc. Ultimately, despite using the same tools, and always dark mode, across all of my machines, the setup for each was different.<p>I think it's safe to set a standard colour-set so that it's immediately usable, but beyond that, a user should be customising to their requirements.<p>Perception differs among people; many of the colours OP listed as unreadable, were barely an issue, bright yellow being the only one I could unequivocally agree on. Perhaps display type, configuration and colour calibration is an important factor, as well as individual perception, ambient conditions, brightness levels, contrast, and perhaps even more variables have a significant effect.<p>I've also learned, since adding an OLED Monitor to my desk alongside the IPS ones, that it's possible to have too much contrast; brightly coloured text alongside pixels that are literally off can be just as problematic to read at times, as low-contrast.
1/29/2026, 4:31:32 PM
by: thinking_cactus
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.
1/29/2026, 5:24:13 PM
by: hnsmhthrow
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.
1/29/2026, 5:25:48 PM
by: assimpleaspossi
Black on white has seemed to work for centuries without issue. For general reading, throw in bold and italic and you're pretty much set. For programming, black on white is still a go to color (or lack thereof).
1/29/2026, 7:15:51 PM
by: lifetimerubyist
I use the built-in TokyoNight Day theme as my light theme in GhosTTY and I think it's almost perfect. Then I use TokyoNightMoon for dark. Works great. Hard to use anything else now.<p>If you're CLI application doesn't play nice with it (i haven't seen many) I don't use it.
1/29/2026, 7:41:25 PM
by: seanwilson
If the goal of the post is to pick terminal colors that contrast on both white/light and black/dark backgrounds, it means you're stuck with midtone colors (between light and dark). This is really limiting for color choice (there's no such thing as "dark yellow" for example), and lowers the maximum contrast you can have for text because you get the best contrast when one color is dark and the other is light.<p>Ideally, instead of the CLI app switching to "bright green", it would pick a "bright contrasting green". So if the terminal background was dark, it would pick bright green, and for light background it would pick a darker green. There isn't CLI app implementations for this? This is similar to how you'd implement dark mode in a web app.
1/29/2026, 4:05:36 PM
by: sroussey
This is true for the console in dev tools as well.<p>Problem there is you can’t change css so at the moment the systems color preference changes thing will look bad.<p>Important considerations for custom formatters.
1/29/2026, 3:55:56 PM
by: munificent
Tangential, but I really love the design of this blog.
1/29/2026, 6:07:29 PM
by:
1/29/2026, 3:51:49 PM
by: bitwize
It's 2026, and app developers are solely responsible for not causing eyehurt, even if their users insist on using the Hotdog Stand theme.
1/29/2026, 4:12:30 PM
by: xenophonf
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.<p>Keep it plain text. Regular, old, boring output is good.
1/29/2026, 3:54:10 PM
by: otabdeveloper4
Step one: *always* assume a dark background.
1/29/2026, 6:13:12 PM
by: maximgeorge
[dead]
1/29/2026, 4:43:44 PM
by: the_gipsy
[flagged]
1/29/2026, 3:32:53 PM
by: keepamovin
Can you work this into an AGENTS.md ? Just so happen to be working on multiple TUI at the moment: text-based modern web browser, VPS rental console, agentic coding wrapper.<p>Colors, have been a perpetual nightmare.
1/29/2026, 4:18:11 PM