Responses to Queries for the Foreground and Background Color Use Different Format #14
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
While testing my
terminal-colorsaurus
library I noticed that the Terminology responds with two different formats to color queries usingOSC 10
/OSC 11
:OSC 10
: Terminology responds with a CSS-like hex format (e.g.#AAAAAA
)OSC 11
: Terminology responds with the XParseColor format (e.g.rgb:2020/2020/2020
)This surprised me, as most other terminals respond with the XParseColor format to both
OSC 10
andOSC 11
. For reference here are some terminals that I have tested.Is the current behaviour intentional? I would be open to submitting a PR to change the
OSC 10
response to also use the XParseColor format.Here are the two commands that I used to test the response:
You might want to check the manual page for XParseColor ... :) You do know why CSS/web support #RRGGB ... it's because web browsers originate on unix... mosaic (whyich gave birth to netscape which begat...) ... and it supported #RRGGBB ... because this is what XParseColor would support - or for that matter this was how you defined colors in X. I assume you didn't grow up with X int he 80's and 90's like me :). It's why you can also use Black,White or even Burlywood (and more string names) as X color names. So in addition to rgb:RRRR/GGGG/BBBB the above "CSS" names as well as just string color names are supported by XParseColor ... they are all valid color strings in they eyes of X11 and XParseColor and thus where all these color defs come from in both color X terminal emulation and in web - they all originate from X11's color specs and XParseColor... so... they are all valid :)
terminology is keeping you in your toes :)
Oh wow, thank you for that prompt and illuminating answer! I should probably work on my man page reading skills :))
hehehe you got me there :)
:) having been there, done that.. i knew #RRGGBB was originally an x color spec.. long before css/web existed :) anyway... all good - things to know/learn and add to your terminal-colorsaurus :) don't forget to ALSO handle x11 color names (like Burlywood) https://en.wikipedia.org/wiki/X11_color_names
:)) Yeah I have been mulling over whether or not to add support for the x11 color names...
It's part of what
XParseColor
accepts and some terminals might thus respond with a color name.On the other hand though, I haven't observed this in practice. Even xterm always responds with
rgb:
, even when I set the color using a color name...Well I might add it anyways just in case :)
After surveying a ... ummm couple 😅 ... of terminals on how they answer to
OSC 10
/OSC 11
queries I am inclined to open this issue again. Almost all terminals that I have looked at only respond with thergb:
format even though they accept multiple formats when setting the colors usingOSC 10
/OSC 11
.Wouldn't it make sense to follow that pattern?
Here are the terminals that I have looked at.
All of them use the
rgb:rrrr/gggg/bbbb
format when responding to queries.What do you think?
Can be configured to use 8-bit color values. ↩︎
Not open source, so I had to test a couple of cases myself. ↩︎
Responds with
rgba:<r>/<g>/<b>/<a>
, 16-bit if the color has an alpha channel ↩︎