Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the Mica material #10509

Closed
DHowett opened this issue Jun 24, 2021 · 13 comments · Fixed by #13935
Closed

Add support for the Mica material #10509

DHowett opened this issue Jun 24, 2021 · 13 comments · Fixed by #13935
Assignees
Labels
Area-Theming Anything related to the theming of elements of the window Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@DHowett
Copy link
Member

DHowett commented Jun 24, 2021

Depends on #10508

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 24, 2021
@sylveon
Copy link

sylveon commented Jun 29, 2021

Blocked by microsoft/microsoft-ui-xaml#5319

@DHowett
Copy link
Member Author

DHowett commented Jun 29, 2021

Oh no. Thanks.

@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Jul 6, 2021
@zadjii-msft zadjii-msft added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. labels Jul 6, 2021
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jul 6, 2021
@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jul 6, 2021
@zadjii-msft zadjii-msft added Area-Theming Anything related to the theming of elements of the window and removed Area-User Interface Issues pertaining to the user interface of the Console or Terminal labels Aug 4, 2021
@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Aug 4, 2021
@selastingeorge
Copy link

@dongle-the-gadget
Copy link

Or you can reference WinUI's source code and create a composition brush for Mica.

@selastingeorge
Copy link

Have you tried using Compositor.TryCreateBlurredWallpaperBackdropBrush() , it gives the blurred wallpaper brush that is used for creating mica. It is also supported in windows.ui.composition

@lzlrd
Copy link

lzlrd commented Apr 5, 2022

There's also the "Tabbed" material used by Explorer [on the last few Insider builds], which would be nice to have for the tab bar's background:
image

@zadjii-msft zadjii-msft removed the Needs-Tag-Fix Doesn't match tag requirements label Apr 5, 2022
@dongle-the-gadget
Copy link

Not sure about its implementation.

@zadjii-msft zadjii-msft mentioned this issue Apr 27, 2022
12 tasks
@ghost ghost added the In-PR This issue has a related PR label Apr 27, 2022
@zadjii-msft zadjii-msft modified the milestones: Up Next, Terminal v1.15 Apr 28, 2022
@ghost ghost removed the In-PR This issue has a related PR label May 4, 2022
@zadjii-msft
Copy link
Member

Since I'm tracking this here: dev/migrie/f/no-custom-caption-btns has the weird version of the terminal with no MinMaxClose control, only the DWM frame. I think that's a dead end though.

@zadjii-msft zadjii-msft self-assigned this Jun 21, 2022
zadjii-msft added a commit that referenced this issue Jul 7, 2022
##### ⚠️ 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>
@zadjii-msft zadjii-msft modified the milestones: Terminal v1.16, Up Next Jul 11, 2022
zadjii-msft added a commit that referenced this issue Jul 14, 2022
⚠️ This spec is going into the `specs/drafts/` folder, because it's CLEARLY not done yet.

I discussed this a bit with Dustin. We felt it would be valuable to have these thoughts committed as a durable artifact. Better to have our Mica thoughts written down somewhere, with the context they belong in. That of course includes the bigger Theming spec, which never got finished. 

I don't think we need to go through the fill spec review for this. Theming is clearly still a WIP. But committing this draft should give a better picture of what the vision is. 

See also: 
* #3327
* #10509

### TODOs
* [ ] The many that are straight up in the doc
* [ ] The fact that there's multiple Mica's now
* [ ] GO look at MSFT:39027976
@ghost ghost added the In-PR This issue has a related PR label Sep 6, 2022
@zadjii-msft zadjii-msft modified the milestones: Up Next, Terminal v1.17 Sep 7, 2022
@ghost ghost closed this as completed in #13935 Dec 9, 2022
ghost pushed a commit that referenced this issue Dec 9, 2022
This reverts commit 19b6d35.

This re-enables support for Mica, and transparent titlebars in general. It also syncs the titlebar opacity with the control opacity for `terminalBackground`. It also somehow fixes the bug where the bottom few pixels of the max btn doesn't work to trigger the snap flyout.

Closes #10509 

Does nothing for #13631

### To-done's

* [x] Check the mica API on 22000, windows 11 RTM
  - this works on 10.0.22621.674, but that's not 22000
* [x] Check how this behaves on windows 10. 
  - For both, this API just no-ops. That's fine! we can just say "Mica is only supported on >=22621"
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Dec 9, 2022
@ghost
Copy link

ghost commented Jan 24, 2023

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

Handy links:

@plashenkov
Copy link

Hey! Thanks for adding Mica!

It's worth noting that you have to move opacity slider to 0 to have Mica effect on a client terminal area.

But you'll see a horizontal line between the client area and the title bar in that case, and the active tab and client area aren't seamless.

To solve this, we can make the title bar darker, and, since we can't have completely transparent elements (tab) over semitransparent (darker title bar), we can add some white to the active tab to workaround this.

{
  "profiles": {
    "defaults": {
      // ...attributes...
      "opacity": 0
    }
  },
  "theme": "Mica",
  "themes": [
    {
      "name": "Mica",
      "window": {
        "applicationTheme": "dark",
        "useMica": true
      },
      "tabRow": {
        "background": "#00000043", // darker
        "unfocusedBackground": "#00000043" // darker
      },
      "tab": {
        "background": "#FFFFFF09", // lighter
        "unfocusedBackground": "#00000000" // transparent
      }
    }
  ]
}

Finally, this is how it looks now:

terminal

@Void48
Copy link

Void48 commented Oct 7, 2023

Hey! Thanks for adding Mica!

It's worth noting that you have to move opacity slider to 0 to have Mica effect on a client terminal area.

But you'll see a horizontal line between the client area and the title bar in that case, and the active tab and client area aren't seamless.

To solve this, we can make the title bar darker, and, since we can't have completely transparent elements (tab) over semitransparent (darker title bar), we can add some white to the active tab to workaround this.

{
  "profiles": {
    "defaults": {
      // ...attributes...
      "opacity": 0
    }
  },
  "theme": "Mica",
  "themes": [
    {
      "name": "Mica",
      "window": {
        "applicationTheme": "dark",
        "useMica": true
      },
      "tabRow": {
        "background": "#00000043", // darker
        "unfocusedBackground": "#00000043" // darker
      },
      "tab": {
        "background": "#FFFFFF09", // lighter
        "unfocusedBackground": "#00000000" // transparent
      }
    }
  ]
}

Finally, this is how it looks now:

terminal

hey @plashenkov
can you please help me make Terminal look like it does in your screenshot? I tried messing with the settings in the JSON file but couldn't get it to work. Could you maybe share your json file so I can just replace mine?

@plashenkov
Copy link

Hey @Void48

I've already posted everything needed. This should really be enough, no need to expose other parts of my config. If you've already added these settings, what do you get?

@Void48
Copy link

Void48 commented Oct 7, 2023

Actually I figured it out @plashenkov 👍🏻

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Theming Anything related to the theming of elements of the window Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants