[PR #11900] Simplify the handling of alpha values in the color table #28800

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

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

State: closed
Merged: Yes


This PR attempts to minimize the amount of fiddling we do with the alpha
color components, by storing all colors with a zero alpha (the default
for COLORREF values) and then leaving it up to the renderer to adjust
the final alpha value as required (which it was already doing anyway).

This gets rid of the argb.h header file, which was originally being
used to produce COLORREF values with custom alpha components, and thus
is no longer required. Anywhere that was using the ARGB macro is now
using a standard RGB macro with a 0 alpha.

The Utils::SetColorTableAlpha method has also been removed, since that
was only really used to force an alpha of 255 on all the color table
entries, which isn't necessary.

There were also a number of places where we were using
til::color::with_alpha, to switch alpha components back and forth
between 0 and 255, which have now been removed. Some of these were
essentially noops, because the til::color class already applied the
appropriate alpha changes when converting from or to a COLORREF.

I've manually run a few attribute rendering tests to check that the
colors were still working correctly, and the default background color is
appropriately transparent when in acrylic mode.

Closes #11885

**Original Pull Request:** https://github.com/microsoft/terminal/pull/11900 **State:** closed **Merged:** Yes --- This PR attempts to minimize the amount of fiddling we do with the alpha color components, by storing all colors with a zero alpha (the default for `COLORREF` values) and then leaving it up to the renderer to adjust the final alpha value as required (which it was already doing anyway). This gets rid of the `argb.h` header file, which was originally being used to produce `COLORREF` values with custom alpha components, and thus is no longer required. Anywhere that was using the `ARGB` macro is now using a standard `RGB` macro with a 0 alpha. The `Utils::SetColorTableAlpha` method has also been removed, since that was only really used to force an alpha of 255 on all the color table entries, which isn't necessary. There were also a number of places where we were using `til::color::with_alpha`, to switch alpha components back and forth between 0 and 255, which have now been removed. Some of these were essentially noops, because the `til::color` class already applied the appropriate alpha changes when converting from or to a `COLORREF`. I've manually run a few attribute rendering tests to check that the colors were still working correctly, and the default background color is appropriately transparent when in acrylic mode. Closes #11885
claunia added the pull-request label 2026-01-31 09:30:50 +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#28800