Open carlos-zamora opened 3 years ago
If we’re going to do that, we should converge all color converters on the VT color parser. All of them. This will change the semantics of our color parser slightly. It’s the only right thing to do.
Back then Dustin brought up the idea of "all the color we know about" in #7578. The XParseColor spec includes the #
format which I think generally surpasses the plain hex format. So yeah this is currently possible using the functions added in #7578 .
You can just feed ColorFromXTermColor
with a string and you'll have the color. See https://github.com/microsoft/terminal/blob/3181b6a5173b915e9f3d2fb44468072126d23881/src/types/ut_types/UtilsTests.cpp#L158
Yeah, it'd also be nice if we could allow for things like "foreground": "red"
in the JSON too.
The only downside is that #eee
will turn into #e0e0e0
(X11 rules) instead of #eeeeee
(CSS rules, current WT)
Well, also that the color table will be copied into a third binary because of static linking but hey, we have a huge Utils problem already.
I think we can prioritize CSS rules if the input is in the form of #eee
in this new ColorFromString
function. On the VT side, we keep the old ColorFromXTermColor
. This way we'll have the best of the both worlds. (anyone noticed that this is actually Hannah Montana reference, anyone?...)
If you're going to prioritize CSS rules for the hex formats, then you also need to consider whether you want to prioritize CSS rules for the color names too (for example, CSS green and X11 green are very different colors). Sooner or later someone is going to ask why a particular color is what it is. That's easy enough to explain if we can just say we're using CSS, or we're using X11. It's harder to justify if we've got a weird mix of the two.
That's actually a valid concern. Maybe we need to also introduce CSS colors and use them specifically for colors in JSON, etc.
获取 Outlook for Androidhttps://aka.ms/ghei36
I think that we should converge on the X11 color names and accept the breaking change (the loss of 4 bits of depth on the short-form hex code colors). @zadjii-msft what do you think?
I think if you're using #abc
now as an alias for #aabbcc
, and we break this by evaluating that now as #a0b0c0
, and the workaround is "change the value to #aabbcc
", then I think that's a perfectly reasonable story. People can deal with that for all of the 4 people using #abc
style colors and who can tell the difference between #ffffff
and #f0f0f0
.
Just so long as no one's expecting "red" to mean "the value of red from the color scheme". That's right out. Not doing that 😛
no one's expecting "red" to mean "the value of red from the color scheme".
I'm not sure, man. Our users have proven to be...imaginative .
I'm fine with converging on the X11 color names. I do believe most people are using #aabbcc
instead of #abc
(see, Github isn't picking this as a valid color). Let's face it, people who bother to use a customized hex code would probably be unsatisfied with simple colors like #abc
.
Also I'm proposing to add support for rgb(111, 111, 111)
format in addition to the X11 formats. This format is used widely on the web as we know it.
Yea I'm cool with the rgb(12, 34, 56)
version too
Also I'm proposing to add support for
rgb(111, 111, 111)
format in addition to the X11 formats.
Can we please make sure that's not exposed in the OSC palette sequences though, unless it's one of the standard formats supported by other terminals.
Of course. It will be separate from existing X11 code.
获取 Outlook for iOShttps://aka.ms/o0ukef
I don't necessarily see the value in rgb(x,y,z)
. If we are working to reduce the number of individual color parsers that we have to support . . . we shouldn't do so and then turn around and add another. As the settings UI gets used more and more, I expect that the incidence of folks using the uncommon syntaxes will evaporate until it reaches 0.
I agree settings UI will reduce the usage of color values in settings.json. However, for command line usgae, i think we should support as many as formats. Hence the rgb idea.
获取 Outlook for Androidhttps://aka.ms/ghei36
Description of the new feature/enhancement
It'd be cool if
--tabColor
andsetTabColor
should accept color names in addition to hex-codes. Specifically, something like this would be accepted:Proposed technical implementation details (optional)
Detecting if it's a name vs hex-code should be pretty straightforward: check if the leading character is a
#
.7578 may help detect if the color name actually exists?