Closed plgruener closed 3 years ago
moar
uses Chroma, which has a sizable number of themes:
https://xyproto.github.io/splash/docs/longer/all.html
I think the correct solution here would be to:
-theme=paraiso-light
command line optionMOAR
environment variableIf you got that, do you think your problem would be solved?
No, only partially. All the themes in Chroma have, as far as I can tell, hardcoded 24bit RGB colors.
What I really want is a colorscheme – either a) included per default and/or b) loadable at runtime from a user-defined config file – that has no own colors, but only the common 16colors (black, red, green,…, bright-red, bright-green,…) and generates the appropriate 4bit ANSI escape codes (eg \e[31m
for a generic "red"). The mapping of those 16colors to their respective rbg-values is already done by my terminal.
That has several advantages: virtually all color-capable programs support those 16colors (but many still don't have 24bit color support), and I can change the colors of all my applications by simply changing the mapping in my terminal. (This allows eg. to quickly switch from a light scheme during the day to a dark one at night.)
Your proposed option would not work, because the colors of the themes Chroma includes may or may not match those of my terminal.
I'd even argue that this 4bit – or ANSI-exclusive, if you will – colortheme should be the default for moar: black-text-on-light-background terminals are not unheard of, they are even the default for some distros. That means new users encountering moar
would think it is unusably broken, see screenshots below. Using only the 4bit colors however ensures that the syntax highlighting is always readable, no matter what terminal theme the user has.
In this screenshot, I've set my terminal to red text on black background. You can see on the line numbers that red default text is respected in some places, but not all.
Cool, thanks for the info!
FWIW, moar
's own UI only uses default foreground and default background colors, so that's why the status bar and the line numbers are red.
Source code coloring on the other hand is done by Chroma in RGB.
How about this then?
moar
gets a -colors=8
flag that tells Chroma to use only 8 colors. Valid values would be 8
, 16
or 256
, or 16M
. Not sure yet what the default should be but let's take that later.MOAR
environment variable.@plgruener I implemented the solution in https://github.com/walles/moar/issues/60#issuecomment-839441554.
In your case, doing export MOAR="-colors=16"
in some init script before invoking moar
that should get you the behaviour you want.
If this does not help, feel free to comment / reopen.
Moar seems to hardcode some (but not all) of its colors. For example a light grey is used for variables and function arguments, but this is almost invisible when using a light background color. Not all Terminals have white font on black background.
Easy-ish solution: don't use hardcoded rgb- or 256-color values anywhere, exclusively use one of the 16 colors set by the terminal. This ensures moar's colors change accordingly when the terminal's colorscheme changes.
(Note: I know dealing with syntax highlighting and colorschemes is hard, especially if you want to support a growing number of programming languages and user-customizable colorschemes (with more than 16colors). I could possibly write you a little summary on how to deal with this, if you're interested.)