[PR #9658] [MERGED] Introduce MS.Term.Core.Color to replace W.U.Color for Core/Control/TSM #27681

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9658
Author: @DHowett
Created: 3/30/2021
Status: ✅ Merged
Merged: 3/30/2021
Merged by: @undefined

Base: main ← Head: dev/duhowett/term_til_term_color


📝 Commits (6)

  • 6b0acf5 Replace Windows::UI::Color with MS::Terminal::Core::Color
  • 37add9f Update MockTermSett
  • 9bda33a PCH fixes
  • 2b01121 Format
  • 3ebc45b SA: Mark MTCC operator noexcept
  • d2925f7 Replace the cascadia default color constants with til::colors

📊 Changes

26 files changed (+210 additions, -142 deletions)

View changed files

📝 src/cascadia/LocalTests_SettingsModel/pch.h (+2 -0)
📝 src/cascadia/TerminalControl/IControlSettings.idl (+1 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+9 -14)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -1)
📝 src/cascadia/TerminalCore/ICoreSettings.idl (+24 -6)
📝 src/cascadia/TerminalCore/Terminal.cpp (+7 -7)
📝 src/cascadia/TerminalCore/Terminal.hpp (+5 -4)
📝 src/cascadia/TerminalCore/pch.h (+6 -0)
📝 src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp (+19 -17)
📝 src/cascadia/TerminalSettingsEditor/Profiles.idl (+5 -5)
📝 src/cascadia/TerminalSettingsEditor/pch.h (+1 -0)
📝 src/cascadia/TerminalSettingsModel/ColorScheme.cpp (+7 -7)
📝 src/cascadia/TerminalSettingsModel/ColorScheme.h (+19 -7)
📝 src/cascadia/TerminalSettingsModel/ColorScheme.idl (+6 -6)
📝 src/cascadia/TerminalSettingsModel/JsonUtils.h (+26 -0)
📝 src/cascadia/TerminalSettingsModel/Profile.h (+5 -5)
📝 src/cascadia/TerminalSettingsModel/Profile.idl (+5 -5)
📝 src/cascadia/TerminalSettingsModel/TerminalSettings.cpp (+11 -15)
📝 src/cascadia/TerminalSettingsModel/TerminalSettings.h (+11 -11)
📝 src/cascadia/TerminalSettingsModel/pch.h (+1 -0)

...and 6 more files

📄 Description

This pull request introduces Microsoft.Terminal.Core.Color as an
alternative to both Windows.UI.Color and uint32_t/COLORREF in the
TerminalCore, ...Control, ...SettingsModel and ...SettingsEditor layers.

M.T.C.Color is trivially convertible to/from til::color and therefore
to/from COLORREF, W.U.Color, and any other color representation we might
need².

I've replaced almost every use of W.U.Color and uint32_t-as-color in the
above layers, with minor exception¹.

The need for this work is twofold.

First: We cannot bear a dependency from TerminalCore (which should,
on paper, be Windows 7 compatible) on Windows.UI or any other WinRT
namespace.

This work removes one big dependency on Windows.UI, but it does not go
all the way.

Second: TerminalCore chose to communicate mostly in packed uint32s
(COLORREF), which was inherently lossy and dangerous.

¹ The UI layers (TerminalControl, TerminalApp) still use
Windows.UI.Color as they are intimately connected to the UWP XAML UI.

² In the future, we might even be able to use the alpha channel...

PR Checklist

  • I ran into the need for this when I introduced cursor inversion
  • Fixes a longstanding itch

Validation Steps Performed

Built and ran all tests for the impacted layers, even the local ones!


🔄 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/9658 **Author:** [@DHowett](https://github.com/DHowett) **Created:** 3/30/2021 **Status:** ✅ Merged **Merged:** 3/30/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/duhowett/term_til_term_color` --- ### 📝 Commits (6) - [`6b0acf5`](https://github.com/microsoft/terminal/commit/6b0acf583823d25bc459b8c1e9efb8ee72358377) Replace Windows::UI::Color with MS::Terminal::Core::Color - [`37add9f`](https://github.com/microsoft/terminal/commit/37add9f7aac1ed64d5738f40ab40ea04d761b018) Update MockTermSett - [`9bda33a`](https://github.com/microsoft/terminal/commit/9bda33a3b47f061907c6c72543bebdaa5d987303) PCH fixes - [`2b01121`](https://github.com/microsoft/terminal/commit/2b01121c9518351de9b63c05492c49376e7c5f59) Format - [`3ebc45b`](https://github.com/microsoft/terminal/commit/3ebc45b8709c5ece7ee51d35342873cdcc2927d1) SA: Mark MTCC operator noexcept - [`d2925f7`](https://github.com/microsoft/terminal/commit/d2925f7b983622395e152b149ed164b0cb2207c1) Replace the cascadia default color constants with til::colors ### 📊 Changes **26 files changed** (+210 additions, -142 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_SettingsModel/pch.h` (+2 -0) 📝 `src/cascadia/TerminalControl/IControlSettings.idl` (+1 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+9 -14) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -1) 📝 `src/cascadia/TerminalCore/ICoreSettings.idl` (+24 -6) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+7 -7) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+5 -4) 📝 `src/cascadia/TerminalCore/pch.h` (+6 -0) 📝 `src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp` (+19 -17) 📝 `src/cascadia/TerminalSettingsEditor/Profiles.idl` (+5 -5) 📝 `src/cascadia/TerminalSettingsEditor/pch.h` (+1 -0) 📝 `src/cascadia/TerminalSettingsModel/ColorScheme.cpp` (+7 -7) 📝 `src/cascadia/TerminalSettingsModel/ColorScheme.h` (+19 -7) 📝 `src/cascadia/TerminalSettingsModel/ColorScheme.idl` (+6 -6) 📝 `src/cascadia/TerminalSettingsModel/JsonUtils.h` (+26 -0) 📝 `src/cascadia/TerminalSettingsModel/Profile.h` (+5 -5) 📝 `src/cascadia/TerminalSettingsModel/Profile.idl` (+5 -5) 📝 `src/cascadia/TerminalSettingsModel/TerminalSettings.cpp` (+11 -15) 📝 `src/cascadia/TerminalSettingsModel/TerminalSettings.h` (+11 -11) 📝 `src/cascadia/TerminalSettingsModel/pch.h` (+1 -0) _...and 6 more files_ </details> ### 📄 Description This pull request introduces Microsoft.Terminal.Core.Color as an alternative to both Windows.UI.Color and uint32_t/COLORREF in the TerminalCore, ...Control, ...SettingsModel and ...SettingsEditor layers. M.T.C.Color is trivially convertible to/from til::color and therefore to/from COLORREF, W.U.Color, and any other color representation we might need². I've replaced almost every use of W.U.Color and uint32_t-as-color in the above layers, with minor exception¹. The need for this work is twofold. First: We cannot bear a dependency from TerminalCore (which should, on paper, be Windows 7 compatible) on Windows.UI or any other WinRT namespace. This work removes one big dependency on Windows.UI, but it does not go all the way. Second: TerminalCore chose to communicate mostly in packed uint32s (COLORREF), which was inherently lossy and dangerous. ¹ The UI layers (TerminalControl, TerminalApp) still use Windows.UI.Color as they are intimately connected to the UWP XAML UI. ² In the future, we might even be able to *use* the alpha channel... ## PR Checklist * [x] I ran into the need for this when I introduced cursor inversion * [X] Fixes a longstanding itch ## Validation Steps Performed Built and ran all tests for the impacted layers, even the local ones! --- <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:23:27 +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#27681