Closed timfjord closed 2 years ago
I think I could merge it for now. In long term, I guess we could support the following options for theme, user
, user_dark
, user_light
and user_auto
.
user_dark
will use user_dark_theme_colors
, user_light
will use user_light_theme_colors
and user_auto
will automatically switch based on the current sublime theme.
Thanks, @randy3k
We might also need to generate two hidden sublime schemas. As far as I understand there is no way to get the information that the sublime theme has been changed. Once we have such an event in place we could switch between dark and light hidden scmehas instantly
Thanks, @randy3k
We might also need to generate two hidden sublime schemas. As far as I understand there is no way to get the information that the sublime theme has been changed. Once we have such an event in place we could switch between dark and light hidden scmehas instantly
Actually, settings.add_on_change
will catch that.
Well, it only catches if there is an explicit change in theme. It doesnot work if the theme is changed implicitly (i.e, theme is set auto and the theme is changed implicitly when the system theme goes light to dark or vise visa.
A not so good solution is to poll the value of sublime.ui_info()['theme']
periodically or when a view is activated.
Actually, I raised a feature request https://github.com/sublimehq/sublime_text/issues/5213
In the meantime, indeed, one solution could be to watching for sublime.ui_info()['theme']['style']
Another solution could perform a check every time a Terminus panel/view is opened. It is a bit limited because existing visible/hidden panels won't be updated, but it won't require polling
This PR is a tentative step towards making Terminus aware of the current sublime theme style(light/dark) and switching between them if the sublime theme is set to
auto
(a V4 feature).It adds support for the
user_light_theme_colors
anduser_dark_theme_colors
settings and makes sure both are involved in the Termiuns theme generation command.This approach is not ideal, because it cannot automatically switch the Terminus theme when Sublime switches the theme. But at least it adds the ability to specify different theme colours and use them during the theme generation process