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

Button for the toolbar to change/cycle through Themes #2010

Closed
AmeJunn opened this issue Sep 17, 2024 · 4 comments
Closed

Button for the toolbar to change/cycle through Themes #2010

AmeJunn opened this issue Sep 17, 2024 · 4 comments

Comments

@AmeJunn
Copy link

AmeJunn commented Sep 17, 2024

Describe the feature

I often find myself changing between my light and dark themes depending on the image, to see it in a different context. But it's really annoying to go to the settings every time to change the theme. It would be nice if there was a quick button, able to be placed on the toolbar, or via hotkey, to quickly change the theme.

How to use feature

  1. Click the button / press the hotkey
  2. The theme is changed

Additional context

Perhaps the themes could be marked to be changed via the button. I use 3 themes, so it's not really a on/off toggle for me for example.

But even if it's just a Dark mode/Light mode switch (like in many websites) it would still be nice. I could set the dark mode theme and the light mode theme and then just press the switch.

@d2phap d2phap added this to the v9.2 milestone Nov 30, 2024
@d2phap
Copy link
Owner

d2phap commented Nov 30, 2024

Similar to #2042 (comment), in the upcoming v9.2, you can use new API IG_ApplySettings(string json) to change the settings without using Settings window.

Here is the JSON to add "Change theme" button to toolbar, in the Arguments, you just need to pass the theme pack name for both DarkTheme and LightTheme:

Change to Dark theme:

{
  "Type": "Button",
  "Id": "btn_custom_1",
  "Text": "Change to Dark theme",
  "DisplayStyle": "Image",
  "CheckableConfigBinding": "",
  "Alignment": "Left",
  "Image": "C:\\path\\to\\icon.svg",
  "OnClick": {
    "Executable": "IG_ApplySettings",
    "Arguments": [
      "{ \"DarkTheme\": \"Kobe\", \"LightTheme\": \"Kobe\" }"
    ]
  }
}

Change to Light theme:

{
  "Type": "Button",
  "Id": "btn_custom_2",
  "Text": "Change to Light theme",
  "DisplayStyle": "Image",
  "CheckableConfigBinding": "",
  "Alignment": "Left",
  "Image": "C:\\path\\to\\icon.svg",
  "OnClick": {
    "Executable": "IG_ApplySettings",
    "Arguments": [
      "{ \"DarkTheme\": \"Kobe-Light\", \"LightTheme\": \"Kobe-Light\" }"
    ]
  }
}

image

d2phap added a commit that referenced this issue Nov 30, 2024
@d2phap
Copy link
Owner

d2phap commented Nov 30, 2024

Updated: You can assign hotkeys to the toolbar buttons, too!

{
  "Type": "Button",
  "Id": "btn_custom_1",
  "Text": "Change to Dark theme",
  "DisplayStyle": "Image",
  "CheckableConfigBinding": "",
  "Alignment": "Left",
  "Image": "C:\\path\\to\\icon.svg",
  "OnClick": {
    "Executable": "IG_ApplySettings",
    "Arguments": [
      "{ \"DarkTheme\": \"Kobe\", \"LightTheme\": \"Kobe\" }"
    ]
  },
  "Hotkeys": ["Alt+D"]
}

image

@AmeJunn
Copy link
Author

AmeJunn commented Nov 30, 2024

Nice thank you!
I'll try it out when it comes out

@d2phap
Copy link
Owner

d2phap commented Dec 8, 2024

Published ImageGlass 9.2.0.1208 - Maroon 4

@d2phap d2phap closed this as completed Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants