frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

How to Choose Colors for Your CLI Applications (2023)

https://blog.xoria.org/terminal-colors/
72•kruuuder•2h ago

Comments

j4cobgarby•1h ago
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.

busterarm•1h ago
> red for bad, green for good

8% of men of Northern European descent (and 0.4% of women) are red-green colorblind. That'd be a terrible choice. Use blue-orange, blue-red, or purple-green.

makapuf•1h ago
More importantly, dont use color as sole source of information. Strikethrough, emoji or ok / bad can also be used.
xenophonf•1h ago
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.
craftkiller•45m ago
> They're hard to type

I'd like to recommend rofimoji. I have it bound to a hotkey, so whenever I want to type an emoji, I just hit that hotkey and then a window pops up with my most recent emoji already visible at the top. Then I start typing in words that describe the emoji that I want like "crying" and it filters the list. Finally I select one and it pastes it into whatever text box I had selected before I hit the hotkey. My only complaint is I wish it worked for all unicode codepoints instead of just the emoji.

skydhash•1h ago
Red/green is semantic in these cases. They’re user configurable in almost all terminals, so there’s no real accessibility issue. I tend to associate blue with decorative accent, yellow with info/warning text, and cyan and magenta for really fancy stuff.
tczMUFlmoNk•1h ago
Red/green has no inherent semantics. It has the semantics that you assign it. If you choose to assign it meaning that disenfranchises 8% of men using your system, that's your choice, but it is not a good one.
skydhash•1h ago
Cultural semantics (diff tools, build tools,…: green/addition/ok, red/removal/error). And people with color blindness can alter the colors to something they can differentiate. And in the ansi sequences, they are actually numbers.
mrob•1h ago
The standard terminal palette is only 16 colors. Even if you compress them all into the green-to-blue color range, it's still possible to distinguish all 16. The user can change "red" and "green" to whatever they like in the terminal preferences and then every 16-color app will be accessible with no additional effort from anybody.
Etheryte•1h ago
This approach is worse. Use red and green like everyone else and the user can choose their terminal color palette to differentiate in a way that works for them. Then it works the same across all commands. If you're the odd one out, you're adding more mental overhead for the user, not less.
account42•41m ago
You are ignoring that most people already have a cultural understanding of the colors red and green. Changes done for accessibility should never making things worse for the average user.
BeetleB•1h ago
Hard disagree on the red/green. Use whatever you think appropriate and make it user configurable.
mrob•1h ago
It's a CLI app, it's already configurable. Every good terminal emulator lets you set custom palettes.
kps•32m ago
>Every good terminal emulator lets you set custom palettes

Not differently for each program's output.

mrob•26m ago
Which is a good reason to stick with the de-facto standard of red for bad and green for good.
sceptic123•11m ago
unless you're colour blind
red_admiral•1h ago
Eh, LS_COLORS is sometimes useful once the meanings are in your subconscious.
fassssst•10m ago
Color is cultural. Red is associated with good in China
xenophonf•1h ago
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.

sroussey•1h ago
This is true for the console in dev tools as well.

Problem there is you can’t change css so at the moment the systems color preference changes thing will look bad.

Important considerations for custom formatters.

sroussey•1h ago
Here is a screenshot for my personal example:

https://github.com/workglow-dev/workglow/blob/main/docs/deve...

Play with it here using dev tools (you can ignore the website itself): https://workglow-web.netlify.app/

Docs including útil for checking dark mode: https://github.com/workglow-dev/workglow/tree/main/packages/...

seanwilson•1h ago
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.

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.

alt187•50m ago
That's called `\e[0;92m`, aka the ANSI terminal espace sequence for bright green. You have 15 others, that will be displayed however the terminal's user wants. They're already available in most terminal color libraries, too.
account42•49m ago
> 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.

The responsibility for this lies with the color scheme not the terminal program.

JoshTriplett•24m ago
CLI apps can detect the background color of the terminal, and determine contrasting colors accordingly.
takluyver•20m ago
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.
JoshTriplett•12m ago
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.
red_admiral•1h ago
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.
account42•51m ago
IMO if your terminal theme does not provide high contrast for "white" text on the default or "black" backgrounds, that's for you to fix. If you want a light terminal then change the color scheme to map "black" to a bright color and "white" to a dark color while making sure that other colors have good contrast to your "black". Don't just change the default foreground and background color and expect every single color using program to fix your mess.
bitwize•1h ago
It's 2026, and app developers are solely responsible for not causing eyehurt, even if their users insist on using the Hotdog Stand theme.
keepamovin•56m ago
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.

Colors, have been a perpetual nightmare.

alias_neo•43m ago
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.

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.

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.

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.

layer8•20m ago
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.

When going beyond that, the colors really need to be configurable on the application.

jammcq•16m ago
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.
bradrn•5m ago
Neither can I. Luckily tweaking the colours can make it somewhat readable. (Sometimes…)

Claude Code Daily Benchmarks for Degradation Tracking

https://marginlab.ai/trackers/claude-code/
242•qwesr123•3h ago•125 comments

OTelBench: AI struggles with simple SRE tasks (Opus 4.5 scores only 29%)

https://quesma.com/blog/introducing-otel-bench/
47•stared•1h ago•31 comments

How to Choose Colors for Your CLI Applications (2023)

https://blog.xoria.org/terminal-colors/
76•kruuuder•2h ago•41 comments

Europe’s next-generation weather satellite sends back first images

https://www.esa.int/Applications/Observing_the_Earth/Meteorological_missions/meteosat_third_gener...
520•saubeidl•10h ago•76 comments

US cybersecurity chief leaked sensitive government files to ChatGPT: Report

https://www.dexerto.com/entertainment/us-cybersecurity-chief-leaked-sensitive-government-files-to...
109•randycupertino•1h ago•50 comments

Reflex (YC W23) Senior Software Engineer Infra

https://www.ycombinator.com/companies/reflex/jobs/Jcwrz7A-lead-software-engineer-infra
1•apetuskey•13m ago

Launch HN: AgentMail (YC S25) – An API that gives agents their own email inboxes

10•Haakam21•32m ago•12 comments

Heating homes with the largest particle accelerator

https://home.cern/news/news/cern/heating-homes-worlds-largest-particle-accelerator
12•elashri•1h ago•1 comments

Making niche solutions is the point

https://ntietz.com/blog/making-niche-solutions-is-the-point/
39•evakhoury•2d ago•9 comments

Apple to soon take up to 30% cut from all Patreon creators in iOS app

https://www.macrumors.com/2026/01/28/patreon-apple-tax/
821•pier25•20h ago•680 comments

Break Me If You Can: Exploiting PKO and Relay Attacks in 3DES/AES NFC

https://www.breakmeifyoucan.com/
26•noproto•2h ago•10 comments

The Sovereign Tech Fund Invests in Scala

https://www.scala-lang.org/blog/2026/01/27/sta-invests-in-scala.html
40•bishabosha•4h ago•28 comments

Mozilla is building an AI 'rebel alliance' to take on OpenAI, Anthropic

https://www.cnbc.com/2026/01/27/mozilla-building-an-ai-rebel-alliance-to-take-on-openai-anthropic...
27•donutshop•28m ago•20 comments

Show HN: ShapedQL – A SQL engine for multi-stage ranking and RAG

https://playground.shaped.ai
55•tullie•2d ago•20 comments

A lot of population numbers are fake

https://davidoks.blog/p/a-lot-of-population-numbers-are-fake
158•bookofjoe•3h ago•131 comments

Playing Board Games with Deep Convolutional Neural Network on 8bit Motorola 6809

https://ipsj.ixsq.nii.ac.jp/records/229345
14•mci•3h ago•1 comments

Render Mermaid diagrams as SVGs or ASCII art

https://github.com/lukilabs/beautiful-mermaid
360•mellosouls•15h ago•52 comments

Run Clawdbot/Moltbot on Cloudflare with Moltworker

https://blog.cloudflare.com/moltworker-self-hosted-ai-agent/
26•ghostwriternr•2h ago•4 comments

Building a High-Performance Rotating Bloom Filter in Java

https://medium.com/@udaysagar.2177/building-a-high-performance-rotating-bloom-filter-in-java-a9e7...
36•udaysagar•4d ago•3 comments

EmulatorJS

https://github.com/EmulatorJS/EmulatorJS
8•avaer•6d ago•0 comments

Vitamin D and Omega-3 have a larger effect on depression than antidepressants

https://blog.ncase.me/on-depression/
673•mijailt•6h ago•457 comments

Waymo robotaxi hits a child near an elementary school in Santa Monica

https://techcrunch.com/2026/01/29/waymo-robotaxi-hits-a-child-near-an-elementary-school-in-santa-...
62•voxadam•3h ago•84 comments

Deep dive into Turso, the "SQLite rewrite in Rust"

https://kerkour.com/turso-sqlite
67•unsolved73•2h ago•37 comments

We can’t send mail farther than 500 miles (2002)

https://web.mit.edu/jemorris/humor/500-miles
567•giancarlostoro•13h ago•86 comments

Mecha Comet – Open Modular Linux Handheld Computer

https://mecha.so/comet
230•Realman78•3d ago•75 comments

Maine’s ‘Lobster Lady’ who fished for nearly a century dies aged 105

https://www.theguardian.com/us-news/2026/jan/28/maine-lobster-lady-dies-aged-105
204•NaOH•15h ago•55 comments

Apt-bundle: brew bundle for apt

https://github.com/apt-bundle/apt-bundle
30•sadeshmukh•4d ago•17 comments

Decompiling Xbox games using PDB debug info

https://i686.me/blog/csplit/
89•orange_redditor•2d ago•13 comments

Tea Chemistry (1997)

https://www.researchgate.net/profile/Matthew-Harbowy/publication/216792045_Tea_Chemistry/links/09...
62•aabiji•5d ago•20 comments

Days numbered for 'risky' lithium-ion batteries

https://www.livescience.com/technology/engineering/days-numbered-for-risky-lithium-ion-batteries-...
16•Brajeshwar•1h ago•5 comments