Move themes out to separate files
All current themes are defined inside a theme.py module. It looks like the next:
elif theme == "midnight":
# {{{ midnight
# Based on XCode's midnight theme
# Looks best in a console with green text against black background
palette_dict.update({
"variables": ("white", "default"),
"var label": ("light blue", "default"),
"var value": ("white", "default"),
...
I propose to create a separate folder, for example, themes. Each theme will be as a separate file JSON or YAML inside a created folder.
I think the theme is not related to an application. Consider a terminal or popular text editors. All of their themes are separate files which easy to install without changing a code.
Pudb lets you use a custom (Python) file for a theme. (see prefs) Why break compatibility with existing themes that people may have in that format?
It might be useful for the builtin themes to be actual separate dictionaries, so that you can easily extend an existing theme without copying and pasting it.
I like Python better than JSON or YAML because you can do special logic if you want.
@inducer
I should change a source code to create my own theme, instead of downloading a simple file with theme config.
That's why there are just 8 themes: "classic", "vim", "dark vim", "midnight", "solarized", "agr-256", "monokai", "monokai-256". If there would be a simple way to add them there would be more of them.
Why break compatibility with existing themes that people may have in that format?
That's an issue. We could change theme's stuff step by step using deprecation warning. A good documentation how to create the own theme would be very helpful.
@asmeurer A theme is a finite number of keys and values and there is no logic. It's UI.
I agree with @discort. Theme for me is more config, than the code. It's just a style sheet. And it seems to be a big overkill to use python syntax for it. I'd prefer YAML or TOML for theme settings.
The DRY problem can be easily solved by some kind of inheritance (optional base parameter that refers to original theme). It would also be an investment to support theme editing from the debugger UI.
I'd also discuss theming abilities. In addition to color and style setting, it could also add some features like panes control (size, positions), rendering options (like this #92).