microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.71k stars 8.33k forks source link

Automatic dark/light theme switching according to OS #6491

Closed xmha97 closed 4 years ago

xmha97 commented 4 years ago

Hello, Please add below feature:

In VSCode I can enable this feature using:

window.autoDetectColorScheme

image

Idea for Windows Terminal: image

j4james commented 4 years ago

I think this is a duplicate of #1230.

xmha97 commented 4 years ago

I think this is a duplicate of #1230.

No, My issue isn't about a bug. It is about a new feature.

beviu commented 4 years ago

If you set "theme" in the config file to "system", it's supposed to work, but right now I think it doesn't work because of that bug.

DHowett commented 4 years ago

So, this needs #1230 to work properly but it isn’t 1230 alone. There’s also a request that the colorScheme be theme switchable :)

j4james commented 4 years ago

Ah, OK. I get it now. That's a neat idea. But do you not then need some way to specify your preferred light color scheme (or vice versa)? Or does it auto detect it based on the name?

DHowett commented 4 years ago

Yeah, that’s a good question :) Probably warrants at least a mini-spec. There’s also a request for focused/unfocused configuration, so I am a bit concerned about adding another dimension to the config matrix.

cscorley commented 4 years ago

The VS Code implementation in the example has up to four "colorScheme" specifications:

image

It is a bit verbose, but is much more flexible than requiring a scheme to define both a dark and a light (or high contrast!) variant. For example, I like Dracula at night but it does not define a light variant, so I use Quiet Light during the day.

mateuszdrab commented 4 years ago

Is there a reason why the terminal's title bar does not inherit the Windows accent color where all the other windows do?

Guess this is due to the fact that it's some custom code handling the title bar rendering due to tabs.

TBBle commented 4 years ago

Title Bar colouring is also what I think @DHowett was referring to earlier, probably #4862, which links through to https://github.com/microsoft/microsoft-ui-xaml/issues/1332.

To throw another axis into the mix, I'd like to be able to use a different colour scheme when running as admin. I have PowerShell (Core) configured to use Solarised Light when elevated instead of Solarised Dark as I normally use.

Although after learning about it from this ticket, I set up VSCode to use Solarized Light/Dark per the OS theme, so maybe I should find a different way of reminding myself when I'm elevated.

Edit: To be clear, I'm talking about if the whole WT process is running elevated, not trying to mix this in with the 'elevated tabs' request. Currently PowerShell Core under conhost ends up ignoring my admin-based colour switch when it draws a cell with text input or Control-L, so if the switch was handled at the WT level and applied the WT colourschemes, it'd work better than it does now, I think.

mateuszdrab commented 4 years ago

You know what even be better? Running an elevated session within your existing terminal window 😄

That one might be difficult to achieve technically due to the various isolations at OS level when it comes to handing admin privileges. Perhaps recent optimisations in regards to console host redirections could make it possible though. It would however, be of great use to me as I normally need one elevated and one non elevated session of powershell.

DHowett commented 4 years ago

Yeah, let’s not pollute this request with the discussion of mixed elevation, which you can absolutely find a place for elsewhere in our issue tracker.

ChristAlbert commented 4 years ago

Isn't this a duplicate of #4066?

zadjii-msft commented 4 years ago

@ChristAlbert good find! It totally is. Thanks for digging that out of our backlog!

/dup #4066

ghost commented 4 years ago

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

electronic-dk commented 4 years ago

@zadjii-msft I thought #4066 spoke about the color profile specifically, while this ticket is about the terminal theme itself (dynamic change without having to restart the terminal). Are these 2 aspects planned to be implemented in scope of one ticket?

zadjii-msft commented 4 years ago

From the way I understand it:

b-hayes commented 3 years ago

Waiting for this feature. Currently, every time I change to dark/light mode I have to open my terminal config file and comment/uncomment my light colour scheme manually. And yes you would need to set a preferred light scheme, every other application I use does it a similar way. The smart ones just remember what colour scheme was active last time you were in light/dark mode.

TBBle commented 3 years ago

@b-hayes Yup, that's being tracked in #4066.

Msouza91 commented 11 months ago

Waiting for this feature. Currently, every time I change to dark/light mode I have to open my terminal config file and comment/uncomment my light colour scheme manually. And yes you would need to set a preferred light scheme, every other application I use does it a similar way. The smart ones just remember what colour scheme was active last time you were in light/dark mode.

I've setup a cron job using sed and some tricks to change between a light and dark theme, the job runs every 29 minutes and checks if the sun is up using hdate. https://pastebin.com/LPc2Fe0h

It is a bit hacky, but works, I've setup the terminal to start up with user login.

zadjii-msft commented 11 months ago

Or, y'know, this feature was added to the Terminal a couple releases back: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/profile-appearance#color-scheme

"colorScheme":
{
    "light": "One Half Light",
    "dark": "One Half Dark",
},
Msouza91 commented 11 months ago

Or, y'know, this feature was added to the Terminal a couple releases back: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/profile-appearance#color-scheme

"colorScheme":
{
    "light": "One Half Light",
    "dark": "One Half Dark",
},

I didn't look too much into it, I couldn't be arsed to read the whole thread so I made a quick hack for it, thanks for showing me this. Now it syncs perfectly with Night Light settings and Auto Dark Mode.

Kellen-Stuart commented 6 months ago

I don't know why but mine just stays on dark no matter what.

"profiles": 
    {
        "defaults": 
        {
            "colorScheme": {
                "dark": "Ayu Dark",
                "light": "Ayu Light"
            },
            "font": 
            {
                "size": 16.0
            }
        },
        "list": 
        ...
adityamwagh commented 6 months ago

@Kellen-Stuart We need to see your complete config file to point out the issue.

zadjii-msft commented 6 months ago

I'm guessing it's your theme setting. That needs to be set to default (or, "use windows theme") to allow the app to switch between themes, so that the scheme can match the app's theme.