NB, the question isn't about how to set colors, as such. It's specificially and explicitly targeting color selection using Set-PSReadLineOption
and no other method whatsoever, including 3rd party tools and what not. Furthermore, it includes altering the color of both (the text as well as the background) and requires an established syntax (such as RGB or HSV) allowing arbitrary manipulation (i.e. no enumerated, predefined literals). And yes, simply it can't be done, go away will be an acceptable, if not happily appreciated, reply. By other words, as far as the scope of this question goes, I'm not interested in alternative ways to affect colors in my window.
Currently I have setup like this.
$options = @{
HistoryNoDuplicates = $true
...
Colors = @{
"Selection" = "#bbdd99"
...
}
}
Set-PSReadLineOption @options
It works and I'm happy with it. However, I'd like to control the background of the selected text as well. According to the docs for PSReadLineOption
it's suppose to be possible and the exact example of such is provided right here.
Set-PSReadLineOption -Colors @{ "Comment"="`e[32;47m" }
There's even another, more sophisticated, example here (the second item, for "string").
Set-PSReadLineOption -Colors @{ "String" = "$([char]0x1b)[38;5;100m" }
That's great but I simply can't for the life of me grasp how to translate that weirdly unusual syntax into the hexa-values (which a normal person can handle) for colors to be able to alter the background as well. And in case it's that weirdo for syntax that is an absolute requirement for altering the background's color, I'm equally clueless how to translate two hexadecimal values (one for the text, one for the back) into the form I'm using on my system (the first sample with @options
variable).
Who came up with that syntax anyway? Are we to understand that MS doesn't want us to horse around with colors or something?!