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 a setting to enable the using the Accent Color for the titlebar #1963

Closed
ghost opened this issue Jul 14, 2019 · 13 comments · Fixed by #12992
Closed

Add a setting to enable the using the Accent Color for the titlebar #1963

ghost opened this issue Jul 14, 2019 · 13 comments · Fixed by #12992
Assignees
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Area-Theming Anything related to the theming of elements of the window Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@ghost
Copy link

ghost commented Jul 14, 2019

Summary of the new feature/enhancement

My feature request is the following: Currently, there is this huge tab at the left of window Title:
https://i.imgur.com/NkCGn3f.jpg but the problem here is, that I am using an accent color that overwrites the title bar for every application.

So I wanted to ask if it would be possible to give us a feature, that we can change that the color of the title bar on the left to the other color, or at least a feature that it automatically gets the same color as the accent color.

Thanks for reviewing.

@ghost ghost added Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. 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 Jul 14, 2019
@zadjii-msft zadjii-msft changed the title Feature Request | Accent Color isn't used Add a setting to enable the using the Accent Color for the titlebar Jul 16, 2019
@zadjii-msft zadjii-msft added Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Jul 16, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jul 16, 2019
@zadjii-msft zadjii-msft added the Area-User Interface Issues pertaining to the user interface of the Console or Terminal label Jul 16, 2019
@zadjii-msft zadjii-msft added this to the Terminal v1.0 milestone Jul 16, 2019
@zadjii-msft
Copy link
Member

I'm changing the title to be slightly more specific.

After #929 we stopped using the accent color, and started drawing the entire titlebar ourselves.

#1934 made the appearance of the titlebar better, but still doesn't use the accent color.

We'll need some way of setting the resources at runtime to override the Background property of the TitlebarControl (introduced in #1948).

This is also related to #1625.

@WSLUser
Copy link
Contributor

WSLUser commented Jul 18, 2019

Any way ColorTool can help with this too? At some point, it may be better to merge Terminal and ColorTool together and use ColorTool for the colors and Terminal settings for applying them based on what's configured in the Settings UI (alternatively the json). I don't think too much rework would be needed here as the functionality would remain but the commands used for executing would be altered. While ColorTool can remain useful on it's own, anybody who can will probably use the Windows Terminal, especially once it reaches v1.

@mdtauk
Copy link

mdtauk commented Jul 18, 2019

Are you able to query the registry to see if that setting is turned on?

image

@modscleo4
Copy link

Are you able to query the registry to see if that setting is turned on?

image

This could be done by accessing the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorPrevalence

public Color ThemeColor
{
    get
    {
        var regBaseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64);
        var regKey = regBaseKey.OpenSubKey(@"Software\Microsoft\Windows\DWM", RegistryKeyPermissionCheck.ReadSubTree);
        if  (regKey != null)
        {
            var value = regKey.GetValue("ColorPrevalence");
            if (value != null && Convert.ToBoolean(value))
            {
                value = regKey.GetValue("ColorizationColor");
                if (value != null) {
                    var color = (uint)(int)value;

                    return Color.FromArgb(
                        (byte)((0xFF000000 & color) >> 24),
                        (byte)((0x00FF0000 & color) >> 16),
                        (byte)((0x0000FF00 & color) >> 8),
                        (byte)((0x000000FF & color) >> 0));
                }
            }
        }

        // This is the default Windows 10 colorization color
        return Color.FromArgb(0xFF, 0x00, 0x78, 0xD7);
    }
}

@DHowett-MSFT DHowett-MSFT added Help Wanted We encourage anyone to jump in on these. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jul 22, 2019
@justingallagher
Copy link

I'm interested in taking a shot at a fix for this one. Would make sense to incorporate this into the existing requestedTheme setting (for example, adding darkAccent or lightAccent themes), or introduce an independent setting?

By default we'd want to follow the system setting, I'm hoping there's an API to read the setting in a more elegant way than digging through the registry.

@zadjii-msft
Copy link
Member

As an update to this thread - this is going to be addressed in a future update as a part of #3327. We're working on a spec currently, but that feature should address this issue in a more unified way with other similar feature requests.

@Poopooracoocoo
Copy link

should this even be a setting? it should just be on when the windows setting is on

@zadjii-msft
Copy link
Member

@Poopooracoocoo Yea, I'd still like this to be an independent setting. As a part of #3327, we're going to let people put whatever color they want there (not just their accent color), or match the color to the color in the terminal control, or throw Acrylic up there, or Mica, or whatever. Much more flexible than just the accent color.

@mdtauk
Copy link

mdtauk commented Jul 23, 2021

@Poopooracoocoo Yea, I'd still like this to be an independent setting. As a part of #3327, we're going to let people put whatever color they want there (not just their accent color), or match the color to the color in the terminal control, or throw Acrylic up there, or Mica, or whatever. Much more flexible than just the accent color.

With the colour picking, it would be neat to allow assigning the Accent Colour to various elements, like the cursor or selected background. Obviously when it comes to the theming, then that allows all kinds of possibilities.

@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 Help Wanted We encourage anyone to jump in on these. labels Aug 4, 2021
@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
@zadjii-msft zadjii-msft self-assigned this Jun 21, 2022
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements and removed In-PR This issue has a related PR labels Jul 7, 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>
@ghost ghost added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Jul 7, 2022
@ghost
Copy link

ghost commented Sep 13, 2022

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

Handy links:

@ijprest
Copy link

ijprest commented Sep 13, 2022

Is this really fixed? The color is influenced by the theme (light or dark), but I don't see the accent color being used, or any settings that reference it.

@DHowett
Copy link
Member

DHowett commented Sep 13, 2022

Yep! If you declare a new theme whose tabRow.backgroundColor is "accent", you'll get this:

image

    "theme": "Cool Things",
    "themes": 
    [
        {
            "name": "Cool Things",
            "tab": 
            {
                "background": "terminalBackground"
            },
            "tabRow": 
            {
                "background": "accent"
            }
        }
    ],

(We should look at offering more inbox themes.)

@Poopooracoocoo
Copy link

I was disappointed when I installed Terminal Preview and saw that this wasn't enabled when the Windows setting is enabled. Is there an issue for tracking respecting the system preference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Area-Theming Anything related to the theming of elements of the window Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements 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.

9 participants