[PR #12992] [MERGED] Initial Theme support #29321

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12992
Author: @zadjii-msft
Created: 4/27/2022
Status: Merged
Merged: 7/7/2022
Merged by: @zadjii-msft

Base: mainHead: dev/migrie/fhl/theming-2022-prototype


📝 Commits (10+)

  • 15e4fd9 Settings project builds at least
  • 7e0ae35 this fixes the App bits as well
  • 00c135b on reload, this changes the BG of the titlebar, but not the tab view
  • b4cd7b3 this is better. Apphost is gonna need to be involved anyways so fuck it
  • 9627483 okay so i bet that resource changed. Whatever, we'll work with it.
  • 84805f5 dumbly accept alpha channel in colors
  • 9670d13 mica works, but the titlebar looks DUMB
  • c555e6e this did seem to work, but will it work for acrylic?
  • 01f07be okay so you can't change a solid brush to an acylic one at runtime
  • ee9333a A pile of dead ends.

📊 Changes

46 files changed (+1398 additions, -136 deletions)

View changed files

📝 .github/actions/spelling/allow/apis.txt (+5 -0)
📝 src/cascadia/LocalTests_SettingsModel/SettingsModel.LocalTests.vcxproj (+1 -0)
src/cascadia/LocalTests_SettingsModel/ThemeTests.cpp (+276 -0)
📝 src/cascadia/TerminalApp/AppLogic.cpp (+30 -10)
📝 src/cascadia/TerminalApp/AppLogic.h (+8 -0)
📝 src/cascadia/TerminalApp/AppLogic.idl (+5 -1)
📝 src/cascadia/TerminalApp/HighlightedText.h (+0 -2)
📝 src/cascadia/TerminalApp/Resources/en-US/Resources.resw (+4 -0)
📝 src/cascadia/TerminalApp/TabManagement.cpp (+4 -0)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+149 -93)
📝 src/cascadia/TerminalApp/TerminalPage.h (+7 -2)
📝 src/cascadia/TerminalApp/TerminalPage.idl (+3 -0)
📝 src/cascadia/TerminalApp/TitlebarControl.xaml (+0 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+16 -0)
📝 src/cascadia/TerminalControl/TermControl.h (+4 -0)
📝 src/cascadia/TerminalControl/TermControl.idl (+3 -1)
📝 src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp (+64 -2)
📝 src/cascadia/TerminalSettingsEditor/GlobalAppearance.h (+9 -1)
📝 src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl (+2 -1)
📝 src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml (+8 -2)

...and 26 more files

📄 Description

⚠️ targeting 1.15

Summary of the Pull Request

Adds support for Themes, a new type of customization for the Terminal. Themes allow the user to customize elements of the Terminal window itself. In this first iteration, this PR adds support for two main properties:

  • enabling Mica as the window backdrop
  • changing the tab row color (read: changing the titelbar color)

These represent the most important asks of theming in the Terminal. The properties added in this PR are:

  • Theme color variants:
    • "#rrggbb" or "#aarrggbb"
    • "accent"
    • "terminalBackground"
  • Properties (listed here in dot notation, but implemented as sub-objects)
    • tabRow.background: accepts a ThemeColor (above)
    • window.applicationTheme: accepts one of {"system", "light", "dark"}
    • window.useMica: accepts a boolean, defaults to false.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

--> GO READ #12530 <--

Seriously.

These themes aren't customizable in the SUI currently. You can change the active theme, and the UI will show all of the defined themes, but they're not editable there.

They don't layer. You'll need to define your own themes.

Thay can't come from fragments. This is a really cool future idea, but not implemented in this v0.

The sub objects have some gnarly macros to generate a lot of the serialization code for you.

TODOs

  • I still have yet to establish what the accent color algorithm is. This might be proprietary and require a ThemeHelpers workaround.
  • Make sure terminalBackground & the SUI result in something sensible
  • Make sure runtime BG changes work with terminalBackground. One time, they didn't. printf "\x1b]11;rgb:ff/00/ff\x07"
  • Acrylic Terminal BG's look weird, like, the opacity is always 50% or something. And the tab row looks all wrong then.

Validation Steps Performed

This is the blob I've been testing with:

    // "useAcrylicInTabRow": true,
    "theme": "my dark",
    // "theme": "Edge",
    "theme": "orangey",
    "theme": "WHITE",
    // "theme": "terminal",
    "themes": [
        {
            "name": "my dark",
            "window": {
                "applicationTheme": "dark",
                "useMica": true,
            },
            "tabRow": {
                "background": "#00000000",
            },
        },
        {
            "name": "Edge",
            "tabRow": { "background": "accent" },
            "window": { "applicationTheme": "system" }
        },
        {
            "name": "orangey",

            "window": {
                "applicationTheme": "light",
                "useMica": true,
            },
            "tabRow": {
                "background": "#ff8800",
            },
        },
        {
            "name": "WHITE",
            "window": {
                "applicationTheme": "dark",
                "useMica": true,
            },
            "tabRow": {
                "background": "#FFFFFF",
            },
        },
        {
            "name": "terminal",

            "window": {
                "applicationTheme": "dark",
                "useMica": false,
            },
            "tabRow": {
                "background": "terminalBackground",
            },
        },
    ]

🔄 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/12992 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 4/27/2022 **Status:** ✅ Merged **Merged:** 7/7/2022 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `main` ← **Head:** `dev/migrie/fhl/theming-2022-prototype` --- ### 📝 Commits (10+) - [`15e4fd9`](https://github.com/microsoft/terminal/commit/15e4fd9be96079e9ef1d5114ee3a2d441b7a4aef) Settings project builds at least - [`7e0ae35`](https://github.com/microsoft/terminal/commit/7e0ae358fba206c10663a829fcbbee97a2477732) this fixes the App bits as well - [`00c135b`](https://github.com/microsoft/terminal/commit/00c135b4d44cdf5684fa5ce895e9ecf257dc1b8d) on reload, this changes the BG of the titlebar, but not the tab view - [`b4cd7b3`](https://github.com/microsoft/terminal/commit/b4cd7b3d71adba9bfa93aa4362513b5d1eeb5a7d) this is better. Apphost is gonna need to be involved anyways so fuck it - [`9627483`](https://github.com/microsoft/terminal/commit/9627483f5668531bce053ef5eafd75f3bec3cbf4) okay so i bet that resource changed. Whatever, we'll work with it. - [`84805f5`](https://github.com/microsoft/terminal/commit/84805f59aab864cb91256d85395d32d932955d1f) dumbly accept alpha channel in colors - [`9670d13`](https://github.com/microsoft/terminal/commit/9670d139a6449ea3e0a79f1006127271d0f3c733) mica works, but the titlebar looks DUMB - [`c555e6e`](https://github.com/microsoft/terminal/commit/c555e6efca7a00743e1b2b5c540bafea901b09f8) this did seem to work, but will it work for acrylic? - [`01f07be`](https://github.com/microsoft/terminal/commit/01f07be64f957e66f2cb95c2605a95dfcd1fd5bc) okay so you can't change a solid brush to an acylic one at runtime - [`ee9333a`](https://github.com/microsoft/terminal/commit/ee9333af13d5323f257f993ab3f6847ef8dc48c9) A pile of dead ends. ### 📊 Changes **46 files changed** (+1398 additions, -136 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/allow/apis.txt` (+5 -0) 📝 `src/cascadia/LocalTests_SettingsModel/SettingsModel.LocalTests.vcxproj` (+1 -0) ➕ `src/cascadia/LocalTests_SettingsModel/ThemeTests.cpp` (+276 -0) 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+30 -10) 📝 `src/cascadia/TerminalApp/AppLogic.h` (+8 -0) 📝 `src/cascadia/TerminalApp/AppLogic.idl` (+5 -1) 📝 `src/cascadia/TerminalApp/HighlightedText.h` (+0 -2) 📝 `src/cascadia/TerminalApp/Resources/en-US/Resources.resw` (+4 -0) 📝 `src/cascadia/TerminalApp/TabManagement.cpp` (+4 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+149 -93) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+7 -2) 📝 `src/cascadia/TerminalApp/TerminalPage.idl` (+3 -0) 📝 `src/cascadia/TerminalApp/TitlebarControl.xaml` (+0 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+16 -0) 📝 `src/cascadia/TerminalControl/TermControl.h` (+4 -0) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+3 -1) 📝 `src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp` (+64 -2) 📝 `src/cascadia/TerminalSettingsEditor/GlobalAppearance.h` (+9 -1) 📝 `src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl` (+2 -1) 📝 `src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml` (+8 -2) _...and 26 more files_ </details> ### 📄 Description ##### ⚠️ targeting 1.15 ## Summary of the Pull Request Adds support for Themes, a new type of customization for the Terminal. Themes allow the user to customize elements of the Terminal window itself. In this first iteration, this PR adds support for two main properties: * enabling Mica as the window backdrop * changing the tab row color (read: changing the titelbar color) These represent the most important asks of theming in the Terminal. The properties added in this PR are: * Theme color variants: - `"#rrggbb"` or `"#aarrggbb"` - `"accent"` - `"terminalBackground"` * Properties (_listed here in dot notation, but implemented as sub-objects_) - `tabRow.background`: accepts a ThemeColor (above) - `window.applicationTheme`: accepts one of `{"system", "light", "dark"}` - `window.useMica`: accepts a boolean, defaults to false. ## References * As first described in #3327 * spec'd in #12530 ## PR Checklist * [x] Sorta enables #10509, but doesn't close it. That'll need more comprehensive changes to the titlebar code. * **update**: I totally disabled mica, but left the serialization code. It just seems silly without #10509. * [x] Closes #1963 * [x] Closes #3774 * [x] Closes #12939 * [x] Does the bulk of the #3327 work, but I'm going to leave that open since that's become my megathread for everything related to theming. * [x] I work here * [x] Tests added/passed * [ ] Requires documentation to be updated - **SURE DOES** ## Detailed Description of the Pull Request / Additional comments ### --> GO READ #12530 <-- Seriously. These themes aren't customizable in the SUI currently. You can change the active theme, and the UI will show all of the defined themes, but they're not editable there. They don't layer. You'll need to define your own themes. Thay can't come from fragments. This is a really cool future idea, but not implemented in this v0. The sub objects have some gnarly macros to generate a lot of the serialization code for you. ### TODOs * [x] I still have yet to establish what the accent color algorithm is. This might be proprietary and require a ThemeHelpers workaround. * [x] Make sure `terminalBackground` & the SUI result in something sensible * [x] Make sure runtime BG changes work with `terminalBackground`. One time, they didn't. `printf "\x1b]11;rgb:ff/00/ff\x07"` * [x] Acrylic Terminal BG's look weird, like, the opacity is always 50% or something. And the tab row looks all wrong then. ## Validation Steps Performed This is the blob I've been testing with: <details> ```jsonc // "useAcrylicInTabRow": true, "theme": "my dark", // "theme": "Edge", "theme": "orangey", "theme": "WHITE", // "theme": "terminal", "themes": [ { "name": "my dark", "window": { "applicationTheme": "dark", "useMica": true, }, "tabRow": { "background": "#00000000", }, }, { "name": "Edge", "tabRow": { "background": "accent" }, "window": { "applicationTheme": "system" } }, { "name": "orangey", "window": { "applicationTheme": "light", "useMica": true, }, "tabRow": { "background": "#ff8800", }, }, { "name": "WHITE", "window": { "applicationTheme": "dark", "useMica": true, }, "tabRow": { "background": "#FFFFFF", }, }, { "name": "terminal", "window": { "applicationTheme": "dark", "useMica": false, }, "tabRow": { "background": "terminalBackground", }, }, ] ``` </details> --- <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:34:14 +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#29321