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 command to toggle between light/dark color themes #151554

Conversation

Balastrong
Copy link
Contributor

@Balastrong Balastrong commented Jun 8, 2022

This PR fixes #151466

This PR adds a new command that allows to toggle between dark and light theme.

If the current theme is high-contrast, it will toggle to the high-contrast counterpart.

@aeschli
Copy link
Contributor

aeschli commented Jun 9, 2022

@Balastrong Thanks for the PR, it's nicely done!
Your proposal is not so much a toggle, more like a regular theme selection dialog.

From reading your issue I was thinking of a command that doesn't need to show a quick pick dialog, but just toggles the theme to the opposite color scheme. So if the current theme is a light theme, it would switch to the preferred dark theme. If it's a dark high contrast theme, it would go to the preferred light high contrast theme.

What do you think of that?

@Balastrong
Copy link
Contributor Author

Thank you for the feedback!

You're right, I went a little bit out of scope but since there are actually four preferred themes I though it would make sense to let you quickly switch between all of them.
However, this adds an extra step for the user (selecting the theme).

If you think it would be more beneficial to just toggle between dark and light with the first command I can easily convert the current code to get that behavior.

@aeschli
Copy link
Contributor

aeschli commented Jun 9, 2022

Let's ask @AllanDaemon who filed the original issue (I just realised it's not you)
@AllanDaemon from reading your issue I was thinking of a command that doesn't need to show a quick pick dialog, but just toggles the theme to the opposite color scheme. So if the current theme is a light theme, it would switch to the preferred dark theme. If it's a dark high contrast theme, it would go to the preferred light high contrast theme.

What do you think of that?

@AllanDaemon
Copy link

AllanDaemon commented Jun 9, 2022

I was thinking of a command that doesn't need to show a quick pick dialog, but just toggles the theme to the opposite color scheme. So if the current theme is a light theme, it would switch to the preferred dark theme. If it's a dark high contrast theme, it would go to the preferred light high contrast theme.

Exactly. So I can assign a keybind and switch it as fast as a shortcut, just like other implementations.

While this PR doesn't implement it, it's an advancement regarding this issue, improving the today's main reason of pain, and I see it filling up others user cases gaps.

@Balastrong
Copy link
Contributor Author

I can rename the implemented feature to something like Switch preferred theme and add a new proper Toggle preferred theme which toggles between light and dark, by keeping whether it's hc or not.

Does it make sense?

@aeschli
Copy link
Contributor

aeschli commented Jun 9, 2022

I'm ok with adding the toggle light/dark theme command, but I don't want add the one with the quick pick.

@Balastrong
Copy link
Contributor Author

Ok so if a light theme is detected switches to preferred dark and vice versa.

What do we want to do with high contrast?
(a) An additional command or (b) detect if the current is hc then go to the hc counterpart automatically?

@aeschli
Copy link
Contributor

aeschli commented Jun 9, 2022

(b)

@Balastrong
Copy link
Contributor Author

Thank you! Code and PR description updated :)

@aeschli aeschli changed the title Added quick input action to toggle between preferred color themes Add command to toggle between light/dark color themes Jun 15, 2022
@aeschli aeschli added this to the June 2022 milestone Jun 16, 2022
@aeschli aeschli requested a review from dbaeumer June 16, 2022 09:25
@aeschli aeschli merged commit 3fec83b into microsoft:main Jun 16, 2022
@Balastrong Balastrong deleted the feature/151466-quick-item-toggle-preferred-team branch June 16, 2022 14:37
justschen pushed a commit to justschen/vscode that referenced this pull request Jun 16, 2022
* Added quick input action to toggle between preferred color themes

* Removed quickpick in favor of command to toggle between ligh/dark and high-contrast counterparts

* Moved toggle logic to themes.contribution

* togglePreferredTheme -> toggleLightDarkThemes

Co-authored-by: Leonardo Montini <leonardo.montini@lab.flowing.it>
Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Jul 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[themes] Command for easy change of light / dark theme
4 participants