mordant icon indicating copy to clipboard operation
mordant copied to clipboard

Low contrast of option values in help in macOS default Terminal in light theme

Open joffrey-bion opened this issue 6 months ago • 6 comments

We've got a report about the CLI help's low contrast in macOS's default Basic theme when the OS appearance is set to Light mode.

Indeed the color of the option values in the help is really bright in this theme:

Image

This is strange because in other light themes the values seemed OK. For example in the Tango light theme on Windows Terminal, we can see very clearly the option values:

Image

Is there anything we can do on our side to smooth these things out?

joffrey-bion avatar Oct 06 '25 12:10 joffrey-bion

The style for that text is warning + muted, so you can adjust either of those theme styles by setting the Terminal on your context, or override styleMetavar of you help formatter to apply a different style.

ajalt avatar Oct 06 '25 16:10 ajalt

I guess I could do this, but that would just work around the problem on my side.

Since I'm using Clikt's default theme (for the most part), I guess it's better if this is fixed upstream in the library defaults. Basically DEFAULT_YELLOW + dim=true yields a poor contrast in light themes.

joffrey-bion avatar Oct 06 '25 18:10 joffrey-bion

Also, why does the style look so different in different terminals/OSes? The DEFAULT_YELLOW color seems to be set as RGB, so I wouldn't expect variations here. Is it about the behavior of dim=true?

joffrey-bion avatar Oct 06 '25 18:10 joffrey-bion

I assume so; dim is interpreted differently on different consoles. Happy to accept a better RGB value if you have one, although keep in mind that there's no way to detect the terminal theme, so it will be the same color in light and dark mode.

ajalt avatar Oct 06 '25 20:10 ajalt

although keep in mind that there's no way to detect the terminal theme, so it will be the same color in light and dark mode.

Yeah I've been there for the "inline code spans" markdown color (see https://youtrack.jetbrains.com/issue/AMPER-4433/Markdown-code-spans-background-is-too-intense-on-light-theme-in-CLI-help). By the way, I could contribute this change back to Mordant if you're interested, because the default style for inline code spans in markdown has a very low contrast. I ended up using some green akin to what Google Docs does when using markdown backticks, with a carefully tuned shade so the contrast is acceptable on both light and dark backgrounds.

Back to the option values style, do you mean that we could avoid dim and use a plain RGB value for these? I wonder if we would find something acceptable. As far as I understood, dim is a way to reduce the contrast of the color without having to know the color theme, which is nice. I wonder if this should be considered an issue of the default macOS theme 🤔

joffrey-bion avatar Oct 07 '25 18:10 joffrey-bion

I think adjusting the RGB color for warning to be more readable is the best solution. I'd be happy to use any values you came up with.

ajalt avatar Oct 07 '25 19:10 ajalt