Introduce a shared class for managing render settings #16214

Closed
opened 2026-01-31 05:00:53 +00:00 by claunia · 1 comment
Owner

Originally created by @j4james on GitHub (Dec 21, 2021).

Description of the new feature/enhancement

This is the final stage of the color table refactoring that I started in #11602 and #11784. What I would like to do now is move the color table and related render settings into a new class that can be shared between conhost and Windows Terminal. This would deduplicate some code that is used in both places, and hopefully make things easier to extend in the future.

An additional benefit is that we can pass a reference to this class into the renderer, so the render engines have direct access to this information, instead of having to lookup colors and render modes via the IRenderData interface. Considering the overhead of the virtual function calls, I'm hoping this should make things a little more efficient.

Proposed technical implementation details (optional)

As I mentioned above, we would have a new class for maintaining what I refer to as RenderSettings. Initially this would hold the color table, and the properties needed to calculate the colors for a given TextAttribute (i.e. things like _screenReversed, _intenseIsBright, _adjustIndistinguishableColors, _blinkingState). Over time we can probably add more to it though.

In Windows Terminal you'd have an instance of this class in the Terminal class, and in conhost it would be in the Settings class. In both cases, a reference to that instance would be passed in to the Renderer class when it's constructed. The renderer in turn can pass that on to the render engines when required.

I'd also like to take this opportunity to introduce the concept of "render modes", and have the boolean properties like _screenReversed and _intenseIsBright stored in a til::enumset. This would make it easier to manage them via the VT mode sequences, and allow for the addition of more modes in the future without introducing a lot of boilerplate code.

The other concept I'd like to introduce is that of "color aliases", which would manage the mapping of special colors like "default foreground" to index positions in the color table. For now this is only needed for the default foreground and background, but in time I'd like to add more (e.g. the bold color proposed in #11939) so it would be good to get a framework in place that's easy to extend.

Originally created by @j4james on GitHub (Dec 21, 2021). # Description of the new feature/enhancement This is the final stage of the color table refactoring that I started in #11602 and #11784. What I would like to do now is move the color table and related render settings into a new class that can be shared between conhost and Windows Terminal. This would deduplicate some code that is used in both places, and hopefully make things easier to extend in the future. An additional benefit is that we can pass a reference to this class into the renderer, so the render engines have direct access to this information, instead of having to lookup colors and render modes via the `IRenderData` interface. Considering the overhead of the virtual function calls, I'm hoping this should make things a little more efficient. # Proposed technical implementation details (optional) As I mentioned above, we would have a new class for maintaining what I refer to as `RenderSettings`. Initially this would hold the color table, and the properties needed to calculate the colors for a given `TextAttribute` (i.e. things like `_screenReversed`, `_intenseIsBright`, `_adjustIndistinguishableColors`, `_blinkingState`). Over time we can probably add more to it though. In Windows Terminal you'd have an instance of this class in the `Terminal` class, and in conhost it would be in the `Settings` class. In both cases, a reference to that instance would be passed in to the `Renderer` class when it's constructed. The renderer in turn can pass that on to the render engines when required. I'd also like to take this opportunity to introduce the concept of "render modes", and have the boolean properties like `_screenReversed` and `_intenseIsBright` stored in a `til::enumset`. This would make it easier to manage them via the VT mode sequences, and allow for the addition of more modes in the future without introducing a lot of boilerplate code. The other concept I'd like to introduce is that of "color aliases", which would manage the mapping of special colors like "default foreground" to index positions in the color table. For now this is only needed for the default foreground and background, but in time I'd like to add more (e.g. the bold color proposed in #11939) so it would be good to get a framework in place that's easy to extend.
claunia added the Issue-FeatureNeeds-TriageResolution-Fix-CommittedNeeds-Tag-Fix labels 2026-01-31 05:00:54 +00:00
Author
Owner

@ghost commented on GitHub (Feb 3, 2022):

:tada:This issue was addressed in #12127, which has now been successfully released as Windows Terminal Preview v1.13.10336.0.🎉

Handy links:

@ghost commented on GitHub (Feb 3, 2022): :tada:This issue was addressed in #12127, which has now been successfully released as `Windows Terminal Preview v1.13.10336.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.13.10336.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16214