How to Choose Colors for Your CLI Applications

https://news.ycombinator.com/rss Hits: 3
Summary

Let’s say you’re creating a CLI tool which has to display syntax highlighted source code. You begin by choosing some colors which look nice with your chosen terminal theme:~ β€” zsh β€” Sorcerer β€” 51Γ—11% highlight foo # just some docs func HelloWorld() [12]u8 { return "hello world\n" } Finished highlighting in 0.02 seconds. % β–ˆNice! However, who knows if it’ll still look good for people who use a theme different to yours? It seems sensible to try out the defaults, at least. Let’s start with the macOS Terminal.app default theme:~ β€” zsh β€” Basic β€” 51Γ—11% highlight foo # just some docs func HelloWorld() [12]u8 { return "hello world\n" } Finished highlighting in 0.02 seconds. % β–ˆ~ β€” zsh β€” Basic β€” 51Γ—11% highlight foo # just some docs func HelloWorld() [12]u8 { return "hello world\n" } Finished highlighting in 0.02 seconds. % β–ˆYouch! It seems fair to try the Tango themes next, since those are the default on e.g. Ubuntu:~ β€” zsh β€” Tango Light β€” 51Γ—11% highlight foo # just some docs func HelloWorld() [12]u8 { return "hello world\n" } Finished highlighting in 0.02 seconds. % β–ˆ~ β€” zsh β€” Tango Dark β€” 51Γ—11% highlight foo # just some docs func HelloWorld() [12]u8 { return "hello world\n" } Finished highlighting in 0.02 seconds. % β–ˆHmm, better, but not by much. Finally, let’s try what is likely the most popular custom terminal theme – Solarized:~ β€” zsh β€” Solarized Light β€” 51Γ—11% highlight foo # just some docs func HelloWorld() [12]u8 { return "hello world\n" } Finished highlighting in 0.02 seconds. % β–ˆ~ β€” zsh β€” Solarized Dark β€” 51Γ—11% highlight foo # just some docs func HelloWorld() [12]u8 { return "hello world\n" } Finished highlighting in 0.02 seconds. % β–ˆWell then … Let’s take a look at each palette and investigate.Sorcerer~ β€” zsh β€” Sorcerer β€” 51Γ—11% colortest β–ˆβ–ˆ black β–ˆβ–ˆ brblack β–ˆβ–ˆ red β–ˆβ–ˆ brred β–ˆβ–ˆ green β–ˆβ–ˆ brgreen β–ˆβ–ˆ yellow β–ˆβ–ˆ bryellow β–ˆβ–ˆ blue β–ˆβ–ˆ brblue β–ˆβ–ˆ magenta β–ˆβ–ˆ brmagenta β–ˆβ–ˆ cyan β–ˆβ–ˆ brcyan β–ˆβ–ˆ white β–ˆβ–ˆ brwhite % β–ˆIn Sorcerer, all colors are readable on the default backgr...

First seen: 2026-01-29 15:32

Last seen: 2026-01-29 17:33