Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to re-define 16 base colors via command line? #45

Open
fooness opened this issue Jun 16, 2023 · 0 comments
Open

Question: How to re-define 16 base colors via command line? #45

fooness opened this issue Jun 16, 2023 · 0 comments

Comments

@fooness
Copy link

fooness commented Jun 16, 2023

This is not an issue with theme.sh, but a mere “how to” question as I did not succeed in finding any documentation.

Hello everyone. For quite some days I am trying to re-define the 16 base colors, set via e.g. my terminal emulator, via the command line (only) inside the currently active shell/session. Unfortunately, after lots of searching, reading, trying, and failing, I still did not succeed with this simple(?) task.

Yesterday I stumbled upon theme.sh and read through the source code, especially the apply_theme() function should be interesting with regards to my question, but I’m still a bit lost due to the many substitutions going on there.

Hence, may I ask you to please provide one, two, or three easy examples on how to re-define one of the 16 base colors?

I did succeed in changing the default foreground color via e.g. printf "\e[38;2;${r};${g};${b}m%s\e\\" "…" where ${r} ${g} ${b} are RGB values calculated from a hex color definition like #ffffff or #000000 et cetera.

How would I re-define e.g. the color black, i.e. \e[30 or bold/bright black (grey), i.e. \e[1;30 or \e[90 for my current shell/session? Thank you so much for hopefully explaining a little bit the approaches of and goings-on in your script.

I am on macOS, and I was testing my color re-definition approaches in iTerm, Terminal, and also tmux — it seems there’s differences for many terminal emulators. Also there seems to be a difference between the direction the bracket is facing in \e[ and \e] and for this I found even less documentation online.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant