[PR #7578] Add support for more OSC color formats #26947

Open
opened 2026-01-31 09:19:04 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/7578

State: closed
Merged: Yes


  • Correct the behaviour of parsing rgb:R/G/B. It should be interpreted
    as RR/GG/BB instead of 0R/0G/0B
  • Add support for rgb:RRR/GGG/BBB and rgb:RRRR/GGGG/BBBB. The
    behaviour of 12 bit variants is to repeat the first digit at the end,
    e.g. rgb:123/456/789 becomes rgb:1231/4564/7897.
  • Add support for # formats. We are following the rules of
    XParseColor by interpreting #RGB as R000G000B000.
  • Add support for XOrg app color names, which are supported by xterm, VTE
    and many other terminal emulators.
  • Multi-parameter OSC 4 is now supported.
  • The chaining of OSC 10-12 is not yet supported. But the parameter
    validation is relaxed by parsing the parameters as multi-params but
    only use the first one, which means \e]10;rgb:R/G/B; and
    \e]10:rgb:R/G/B;invalid will execute OSC 10 with the first color
    correctly. This fixes some of the issues mentioned in #942 but not
    all of them.

Closes #3715

**Original Pull Request:** https://github.com/microsoft/terminal/pull/7578 **State:** closed **Merged:** Yes --- * Correct the behaviour of parsing `rgb:R/G/B`. It should be interpreted as `RR/GG/BB` instead of `0R/0G/0B` * Add support for `rgb:RRR/GGG/BBB` and `rgb:RRRR/GGGG/BBBB`. The behaviour of 12 bit variants is to repeat the first digit at the end, e.g. `rgb:123/456/789` becomes `rgb:1231/4564/7897`. * Add support for `#` formats. We are following the rules of [XParseColor] by interpreting `#RGB` as `R000G000B000`. * Add support for XOrg app color names, which are supported by xterm, VTE and many other terminal emulators. * Multi-parameter OSC 4 is now supported. * The chaining of OSC 10-12 is not yet supported. But the parameter validation is relaxed by parsing the parameters as multi-params but only use the first one, which means `\e]10;rgb:R/G/B;` and `\e]10:rgb:R/G/B;invalid` will execute `OSC 10` with the first color correctly. This fixes some of the issues mentioned in #942 but not all of them. [XParseColor]: https://linux.die.net/man/3/xparsecolor Closes #3715
claunia added the pull-request label 2026-01-31 09:19:04 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26947