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

From: Daniel Vartanov <dan_AT_vartanov.net>
Date: Thu, 2 Aug 2018 06:15:12 +0100

Just in case it is still relevant I cite a part of dwm description
drom suckless.org where it explains why editing the source code and
recompilation is the best way of configuring such type of software:

"""

dwm is customized through editing its source code, which makes it
extremely fast and secure - it does not process any input data which
isn’t known at compile time, except window titles and status text read
from the root window’s name. You don’t have to learn Lua/sh/ruby or
some weird configuration file format (like X resource files), beside
C, to customize it for your needs: you only have to learn C (at least
in order to edit the header file).
"""

Cheers,
Daniel

On 1 August 2018 at 23:38, S. Gilles <sgilles_AT_math.umd.edu> wrote:
> On 2018-07-30T18:52:11+0200, Timur Fayzrakhmanov wrote:
>> Halo!
>>
>> I've tried to change color scheme using the following project
>> https://github.com/chriskempson/base16-shell. But I didn't get a success.
>> It seems like the colors are hardcoded at config.def.h and can not be
>> changed then. Unfortunately, I don't know well internals of the st nor the
>> terminal emulators in general so I hope to get a hint.
>> Thank you all.
>
> As others have said, the right way to do this is to change config.h
> and recompile. However:
>
> The 256-color palette of st is mutable, since st supports the
> can-change-color property. Try something like
>
> printf '\033]4;0;rgb:10/20/30\033\\'
>
> That should change all black in the current window to a sort of
> dark blue. The syntax is
>
> printf '\033]4;N;rgb:R/G/B\033\\'
>
> where N is a number from 0 to 255 (the color index), and R, G, B
> are hex numbers from 0 to ff specifying the intensity of the color.
> If you have 256color.pl (or a variation), you can run
>
> 256color.pl
> for x in $(seq 0 255); do
> r=$(head -c 1 /dev/urandom | od -t u1 -A n | tr -d ' ')
> g=$(head -c 1 /dev/urandom | od -t u1 -A n | tr -d ' ')
> b=$(head -c 1 /dev/urandom | od -t u1 -A n | tr -d ' ')
> printf '\033]4;%s;rgb:%2x/%2x/%2x\033\\' ${x} ${r} ${g} ${b}
> done
>
> This is handled in st.c around line 1858, if you want to see more.
>
> --
> S. Gilles
>
Received on Thu Aug 02 2018 - 07:15:12 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 02 2018 - 07:24:07 CEST