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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11900
Author: @j4james
Created: 12/8/2021
Status: Merged
Merged: 12/15/2021
Merged by: @undefined

Base: mainHead: nuke-argb


📝 Commits (5)

  • 04e3eb1 Remove all usage of argb.h
  • 775249d Drop unnecessary with_alpha calls.
  • 2c3a8ed Drop unnecessary OPACITY_OPAQUE.
  • 7f7c029 Drop more unnecessary with_alpha calls.
  • 3f65919 Get rid of the SetColorTableAlpha function.

📊 Changes

15 files changed (+13 additions, -72 deletions)

View changed files

📝 src/cascadia/LocalTests_SettingsModel/ColorSchemeTests.cpp (+0 -1)
📝 src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp (+4 -4)
📝 src/cascadia/LocalTests_SettingsModel/pch.h (+0 -1)
📝 src/cascadia/LocalTests_TerminalApp/pch.h (+0 -1)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+1 -1)
📝 src/cascadia/TerminalControl/ControlInteractivity.cpp (+0 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+1 -1)
📝 src/cascadia/TerminalCore/Terminal.cpp (+6 -14)
📝 src/cascadia/UnitTests_Control/pch.h (+0 -1)
📝 src/cascadia/UnitTests_Remoting/pch.h (+0 -1)
📝 src/cascadia/UnitTests_TerminalCore/ScrollTest.cpp (+0 -1)
📝 src/cascadia/ut_app/precomp.h (+0 -1)
src/inc/argb.h (+0 -26)
📝 src/renderer/dx/CustomTextRenderer.cpp (+1 -2)
📝 src/types/inc/colorTable.hpp (+0 -16)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/11900 **Author:** [@j4james](https://github.com/j4james) **Created:** 12/8/2021 **Status:** ✅ Merged **Merged:** 12/15/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `nuke-argb` --- ### 📝 Commits (5) - [`04e3eb1`](https://github.com/microsoft/terminal/commit/04e3eb10c0bb09a4a003d448a4d7aaea0ca437a5) Remove all usage of argb.h - [`775249d`](https://github.com/microsoft/terminal/commit/775249dd78d3db14062b0329ed51564cabea4665) Drop unnecessary with_alpha calls. - [`2c3a8ed`](https://github.com/microsoft/terminal/commit/2c3a8ed165a9c9682e8375b3a2d931219865b24e) Drop unnecessary OPACITY_OPAQUE. - [`7f7c029`](https://github.com/microsoft/terminal/commit/7f7c029356b7076086f412bc42e3c91d51a08ccf) Drop more unnecessary with_alpha calls. - [`3f65919`](https://github.com/microsoft/terminal/commit/3f6591916c9cb06644f4f88db5edcec1ff025246) Get rid of the SetColorTableAlpha function. ### 📊 Changes **15 files changed** (+13 additions, -72 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_SettingsModel/ColorSchemeTests.cpp` (+0 -1) 📝 `src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp` (+4 -4) 📝 `src/cascadia/LocalTests_SettingsModel/pch.h` (+0 -1) 📝 `src/cascadia/LocalTests_TerminalApp/pch.h` (+0 -1) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+1 -1) 📝 `src/cascadia/TerminalControl/ControlInteractivity.cpp` (+0 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+1 -1) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+6 -14) 📝 `src/cascadia/UnitTests_Control/pch.h` (+0 -1) 📝 `src/cascadia/UnitTests_Remoting/pch.h` (+0 -1) 📝 `src/cascadia/UnitTests_TerminalCore/ScrollTest.cpp` (+0 -1) 📝 `src/cascadia/ut_app/precomp.h` (+0 -1) ➖ `src/inc/argb.h` (+0 -26) 📝 `src/renderer/dx/CustomTextRenderer.cpp` (+1 -2) 📝 `src/types/inc/colorTable.hpp` (+0 -16) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:30:48 +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#28795