Re: [dev] [st] Hardcoded colors. Can I change them runtime?

From: opal hart <opal_AT_wowana.me>
Date: Wed, 1 Aug 2018 20:18:30 +0000

On Wed, 1 Aug 2018 21:33:50 +0200
Timur Fayzrakhmanov <timfayz.only_AT_gmail.com> wrote:

> Something like printf "\\e]P%x%s" where %x is color index
> and %s is RGB color. As I observed it's kind of "standard" way of
> applying color schemes.

I see. `OSC P` only works for the Linux VT, so it isn't standard as you
describe. You may be thinking of `OSC 1` which works in xterm and
urxvt. I would assume that st does not aim to implement all escape
sequences because it adds to code complexity, and not many of these
escape sequences are in wide enough use to warrant being included. You
are welcome to implement these escape codes yourself and create a patch
for others to use, if one doesn't already exist.

> Ok (if there is no way but use config.h), how to set the rest of six
> colors to form 216 RGB color space?
> ```
> static const char *colorname[] = {
> /* 8 normal colors */
> ...
> /* 8 bright colors */
> ...
> [255] = 0,
>
> /* Here? */
> /* BTW, does 232-255 grayscale colors (from black to white in 24
> steps) are formed automatically and not need to be set explicitly? */
> ```

Yes, it's a normal array of colours. To set colour 215 (starting from
0), for example, just add a line `[215] = "#123456",` and it will set
that colour as appropriate. However, st already supports both
256-colour and truecolour so you may not need to do this depending on
what you are specifically doing.

[Please fix your mail client's quoting, by the way.]
-- 
wowaname <https://wowana.me/pgp>
Please use detailed subject lines and reply below quoted text
whenever possible.
Received on Wed Aug 01 2018 - 22:18:30 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 01 2018 - 22:24:07 CEST