Clarify how to use the default color #1242
-
The linked manual pages (color & default_colors ) are too dense just to learn about this concept and then figure out how to extrapolate to the notcurses API. We would really benefit from a more succint and easy to grok explanation. Truth is I still don't understand how I'm supposed to use it. I'd love to have a minimal example of how a new plane is supposed to customize and show its default colors, and switch to non-default colors, so I can create some beginners friendly documentation and examples for the rust bindings. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
To simplify, we will assume that all terminals have all of a) default colors b) palette-indexed and c) RGB colors. First off, everything maps to the RGB domain. A palette is just a set of RGB values. The default colors are RGB. There are no colors accessible via defaults/palettes that are not accessible via RGB. The default colors are a single foreground and background color, set by the terminal, and usually exposed to user configuration. My terminals -- my shells -- have black backgrounds with white text, because i'm a sane fucking human being. Some people prefer black on white. I once worked with someone who, swear-to-God, used goldenrod on salmon. It was the ugliest thing i've ever seen. Anyway, thus your default foreground/background color. These are the colors you ought use unless you have a reason to use some other one. In particular, it's goodwill to honor the user's background preference. Does your app need to have a black or white background? Can you use the user's preferred one? Maybe, maybe not. Point is, these are "variables" from Notcurses's perspective -- you say "use $defaultcolor" as opposed to "use this RGB value". Put another way, using especially the default background color in your UI is, in a fashion, conforming to the user's theming. Furthermore, you can assume these two colors are well-represented by the terminal, since again they have been chosen. RGB will decay in environments that don't support real TrueColor. Does that make sense? The default colors are free insight into the user's desired colors (i.e. no need to go read some config file). Effectively, the background default color tells you the user's desired background color, and the foreground default color gives you a color known to be readable on that background color. |
Beta Was this translation helpful? Give feedback.
To simplify, we will assume that all terminals have all of a) default colors b) palette-indexed and c) RGB colors.
First off, everything maps to the RGB domain. A palette is just a set of RGB values. The default colors are RGB. There are no colors accessible via defaults/palettes that are not accessible via RGB.
The default colors are a single foreground and background color, set by the terminal, and usually exposed to user configuration. My terminals -- my shells -- have black backgrounds with white text, because i'm a sane fucking human being. Some people prefer black on white. I once worked with someone who, swear-to-God, used goldenrod on salmon. It was the ugliest thing i've ever see…