Tech News
← Back to articles

How to choose colors for your CLI applications (2023)

read original related products more articles

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

" } 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

" } Finished highlighting in 0.02 seconds. % █

~ — zsh — Basic — 51×11 % highlight foo # just some docs func HelloWorld () [ 12 ] u8 { return "hello world

" } 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

... continue reading