Skip to content

Programatically change the colors or theme? #14102

Answered by j4james
greggman asked this question in Q&A
Discussion options

You must be logged in to vote

Probably the easiest way to do this would be with the DECAC escape sequence, which controls which palettes entries are used for the foreground and background colors. The defaults for foreground and background are usually 261 and 262, and the red from your chosen color scheme will be 1, so to switch the background to red (1), while keeping the default foreground (261), you'd use a command like this:

echo "`e[1;261;1,|"

Then to switch back to the default background color, you could do this:

echo "`e[1;261;262,|"

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by greggman
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants