randy3k / Terminus

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

Add adaptive theme #294

Closed jwortmann closed 3 years ago

jwortmann commented 3 years ago

This is a suggestion how to derive ANSI colors from the active color scheme on ST4.

To update the generated adaptive theme when the user has just changed their color scheme, either open the "Terminus: Select Theme" panel again, switch to another item and back to "adaptive", or uncomment the code on the bottom (that's probably not a good solution because it would also regenerate the theme on color scheme changes even if the Terminus theme is not "adaptive".

The way how to derive "light_black" from the comment foreground color is also not optimal, because it only works if there is a view opened in the active window.

randy3k commented 3 years ago

Thanks, it does look like a very viable option. I still haven't had time to play with the new function sublime.ui_info().

randy3k commented 3 years ago

To update the generated adaptive theme when the user has just changed their color scheme, either open the "Terminus: Select Theme" panel again, switch to another item and back to "adaptive"

It sounds fair.

jwortmann commented 3 years ago

I still haven't had time to play with the new function sublime.ui_info().

sublime.ui_info() seems to be the best way here to get the *ish colors and foreground/background from the color scheme without the need to have a view (otherwise View.style() could also be used).

I've added a commit to regenerate the adaptive theme when the color scheme changes and it seems to work well, but I don't really understand what's going on in the settings_on_change function, so you'd want to double check that I didn't do any mischief here.

randy3k commented 3 years ago

It looks good to me. But let me think of a better way to determine the white color before merging it.

randy3k commented 3 years ago

Merged manually.

randy3k commented 3 years ago

Instead of using the active_view, the new code uses windows.create_output_panel to create a hidden panel for the scope.