]> git.lizzy.rs Git - micro.git/commit
Fix some issues with default colors in colorschemes (#2225)
authorDmitry Maluka <dmitrymaluka@gmail.com>
Tue, 28 Sep 2021 20:30:29 +0000 (22:30 +0200)
committerGitHub <noreply@github.com>
Tue, 28 Sep 2021 20:30:29 +0000 (13:30 -0700)
commit9ad4437a98893504445fd44ad8b0300bedfeeb54
treec3300f8502e28fcf7129ab49536e96e5e0758686
parenta21a720941250ddc4e1e8cf917f6fde4b3a4324e
Fix some issues with default colors in colorschemes (#2225)

* Fix default colors for unconfigured syntax groups

When GetColor is called for a syntax group not specified in the
colorscheme, it should fallback not to the terminal's default colors
(tcell.DefaultColor) but to the colorscheme's defaults (DefStyle)
which may be different from tcell.DefaultColor.

For example, if we are using micro's default colorscheme in a terminal
which uses a black-on-white theme, then dots and commas in Go files
("symbol" syntax group in go.yaml) are displayed black on a dark
background, i.e. barely visible.

* Avoid using terminal's default colors directly

If a syntax group color is set to "default" (which we have for some
syntax groups in some colorschemes), it defaults to the terminal's
default colors (tcell.DefaultColor), which is fine for 16-color
colorschemes but not quite fine for truecolor and 256-color
colorschemes which should not depend on the terminal colors.
It should default to the colorscheme's default (DefStyle) instead.

For example, if we are using micro's default colorscheme in a terminal
which uses a black-on-white theme, then "bool" type in C files
("type.extended" syntax group in c.yaml) is displayed black on a dark
background, i.e. barely visible.
internal/config/colorscheme.go