randy3k / Terminus

Bring a real terminal to Sublime Text
https://packagecontrol.io/packages/Terminus
MIT License
1.37k stars 83 forks source link

Adaptive theme is changing color only on reapply #364

Open psydvl opened 2 years ago

psydvl commented 2 years ago

If you select adaptive theme and toggle OS style between dark/light, Sublime Text will follow this change, however Terminus not until you reselect (for example, with up|down arrows) and reapply Adaptive theme in Terminus Utilities: Select Theme

Screenshots | Before style changing | After style changing | | --- | --- | | ![Screenshot](https://user-images.githubusercontent.com/43755002/175792244-68b9bdb6-aefd-47ac-a5e1-fce9f4b20579.png) | ![Screenshot from 2022-06-26 01-26-15](https://user-images.githubusercontent.com/43755002/175792257-b95e5224-050e-412a-b493-e212db343a58.png) | | ![Screenshot](https://user-images.githubusercontent.com/43755002/175792266-5acf184a-a518-4429-8798-0a7e2084467a.png) | ![Screenshot](https://user-images.githubusercontent.com/43755002/175792267-7eea18e6-ee91-452e-8abd-3dc9998fedbe.png) | OS: openSUSE Tumbleweed, GNOME 42.2, Sublime Text 4 (Build 4126)
skopjanecot commented 2 years ago

I can confirm this behaviour. I mapped keybindings to actully switch between themes. Hope it gets resolved soon.

randy3k commented 2 years ago

It is unfortunately no easy fix for now due to the lack of API. Let's keep it open.

skopjanecot commented 2 years ago

Can you tap into ST's state regarding theme? Something like checking which theme ST is on every 30s or so?

psydvl commented 2 years ago

@randy3k As I see, there is a function can be used for this, however it works starts from Sublime Text 4: https://www.sublimetext.com/docs/api_reference.html#sublime.ui_info 1) system.style 2) theme.style

>>> sublime.ui_info() # light
{'color_scheme': {'palette': {'accent': '#183691', 'background': '#ffffff', 'bluish': '#183691', 'cyanish': '#0086b3', 'foreground': '#333333', 'greenish': '#63a35c', 'orangish': '#df5000', 'pinkish': '#990073', 'purplish': '#795da3', 'redish': '#f93232', 'yellowish': '#75715e'}, 'resolved_value': 'Packages/Github Color Theme/GitHub.tmTheme', 'value': 'auto'}, 'system': {'style': 'light'}, 'theme': {'resolved_value': 'Adaptive.sublime-theme', 'style': 'light', 'value': 'Adaptive.sublime-theme'}}
>>> sublime.ui_info() #dark
{'color_scheme': {'palette': {'accent': '#49e0fd', 'background': '#1c1c1c', 'bluish': '#49e0fd', 'cyanish': '#2be98a', 'foreground': '#cccccc', 'greenish': '#b0ec38', 'orangish': '#fd971f', 'pinkish': '#f92672', 'purplish': '#ae81ff', 'redish': '#e62a19', 'yellowish': '#e6db74'}, 'resolved_value': 'Packages/Monokai++/themes/Monokai++.tmTheme', 'value': 'auto'}, 'system': {'style': 'dark'}, 'theme': {'resolved_value': 'Adaptive.sublime-theme', 'style': 'dark', 'value': 'Adaptive.sublime-theme'}}

NB: I've used Ctrl+` console for this execution

DiegoAz commented 11 months ago

I'm using the following to reapply the theme in case someone else finds it helpful:

{
        "keys": ["ctrl+alt+t"],
        "command": "terminus_open",
        "args": {
            "title": "Terminal",
            "post_window_hooks": [
                ["carry_file_to_pane", {"direction": "down"}],
                ["terminus_select_theme", {"theme": "user"}],
                ["terminus_select_theme", {"theme": "adaptive"}]
            ],

        }
    },