-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Initial support for Spyder's dark theme #8020
Changes from 10 commits
caece8a
2a3f3fe
e3353d3
f7c88c1
009435b
6f5984e
deaeeaa
57ed7d5
c812580
c9f26fd
9ce1c0a
974c2f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ pyqt5 | |
keyring | ||
spyder-kernels>=1.0 | ||
python-language-server | ||
qdarkstyle |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -465,6 +465,7 @@ | |
}), | ||
('color_schemes', | ||
{ | ||
'color_theme': 'automatic', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change this option name to |
||
'names': ['emacs', 'idle', 'monokai', 'pydev', 'scintilla', | ||
'spyder', 'spyder/dark', 'zenburn', 'solarized/light', | ||
'solarized/dark'], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
from spyder.widgets.colors import ColorLayout | ||
from spyder.widgets.comboboxes import FileComboBox | ||
from spyder.plugins.editor.widgets.codeeditor import CodeEditor | ||
from spyder.config.gui import is_dark_font_color | ||
|
||
|
||
HDPI_QT_PAGE = "https://doc.qt.io/qt-5/highdpi.html" | ||
|
@@ -911,7 +912,6 @@ def setup_page(self): | |
icons_combo = self.create_combobox(_('Icon theme'), icon_choices, | ||
'icon_theme', restart=True) | ||
|
||
|
||
vertdock_box = newcb(_("Vertical title bars in panes"), | ||
'vertical_dockwidget_titlebars') | ||
verttabs_box = newcb(_("Vertical tabs in panes"), | ||
|
@@ -1171,17 +1171,29 @@ def setup_page(self): | |
'selected') | ||
self.schemes_combobox = schemes_combobox_widget.combobox | ||
|
||
# Layouts | ||
vlayout = QVBoxLayout() | ||
color_themes = ['Automatic', 'Light', 'Dark'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
color_theme_choices = list(zip(color_themes, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
[color_theme.lower() | ||
for color_theme in color_themes])) | ||
color_theme_combo = self.create_combobox(_('User interface theme:'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
color_theme_choices, | ||
'color_theme', | ||
restart=True) | ||
|
||
# Layouts | ||
manage_layout = QVBoxLayout() | ||
manage_layout.addWidget(about_label) | ||
|
||
combo_layout = QHBoxLayout() | ||
combo_layout.addWidget(schemes_combobox_widget.label) | ||
combo_layout.addWidget(schemes_combobox_widget.combobox) | ||
|
||
color_theme_combo_layout = QHBoxLayout() | ||
color_theme_combo_layout.addWidget(color_theme_combo.label) | ||
color_theme_combo_layout.addWidget(color_theme_combo.combobox) | ||
|
||
buttons_layout = QVBoxLayout() | ||
buttons_layout.addLayout(color_theme_combo_layout) | ||
buttons_layout.addLayout(combo_layout) | ||
buttons_layout.addWidget(edit_button) | ||
buttons_layout.addWidget(self.reset_button) | ||
|
@@ -1200,6 +1212,7 @@ def setup_page(self): | |
manage_group = QGroupBox(_("Manage color schemes")) | ||
manage_group.setLayout(manage_layout) | ||
|
||
vlayout = QVBoxLayout() | ||
vlayout.addWidget(manage_group) | ||
self.setLayout(vlayout) | ||
|
||
|
@@ -1223,15 +1236,46 @@ def setup_page(self): | |
|
||
def apply_settings(self, options): | ||
self.set_option('selected', self.current_scheme) | ||
self.main.editor.apply_plugin_settings(['color_scheme_name']) | ||
if self.main.ipyconsole is not None: | ||
self.main.ipyconsole.apply_plugin_settings(['color_scheme_name']) | ||
if self.main.historylog is not None: | ||
self.main.historylog.apply_plugin_settings(['color_scheme_name']) | ||
if self.main.help is not None: | ||
self.main.help.apply_plugin_settings(['color_scheme_name']) | ||
self.update_combobox() | ||
self.update_preview() | ||
color_scheme = self.get_option('selected') | ||
color_theme = self.get_option('color_theme') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
style_sheet = self.main.styleSheet() | ||
if color_theme == 'automatic': | ||
if ((not is_dark_font_color(color_scheme) and not style_sheet) | ||
or (is_dark_font_color(color_scheme) and style_sheet)): | ||
self.changed_options.add('color_theme') | ||
elif 'color_theme' in self.changed_options: | ||
self.changed_options.remove('color_theme') | ||
|
||
if 'color_theme' not in self.changed_options: | ||
self.main.editor.apply_plugin_settings(['color_scheme_name']) | ||
if self.main.ipyconsole is not None: | ||
self.main.ipyconsole.apply_plugin_settings( | ||
['color_scheme_name']) | ||
if self.main.historylog is not None: | ||
self.main.historylog.apply_plugin_settings( | ||
['color_scheme_name']) | ||
if self.main.help is not None: | ||
self.main.help.apply_plugin_settings(['color_scheme_name']) | ||
self.update_combobox() | ||
self.update_preview() | ||
else: | ||
if 'color_theme' in self.changed_options: | ||
if (style_sheet and color_theme == 'dark' or | ||
not style_sheet and color_theme == 'light'): | ||
self.changed_options.remove('color_theme') | ||
|
||
if 'color_theme' not in self.changed_options: | ||
self.main.editor.apply_plugin_settings(['color_scheme_name']) | ||
if self.main.ipyconsole is not None: | ||
self.main.ipyconsole.apply_plugin_settings( | ||
['color_scheme_name']) | ||
if self.main.historylog is not None: | ||
self.main.historylog.apply_plugin_settings( | ||
['color_scheme_name']) | ||
if self.main.help is not None: | ||
self.main.help.apply_plugin_settings(['color_scheme_name']) | ||
self.update_combobox() | ||
self.update_preview() | ||
|
||
# Helpers | ||
# ------------------------------------------------------------------------- | ||
|
@@ -1532,6 +1576,8 @@ def add_color_scheme_stack(self, scheme_name, custom=False): | |
|
||
if not custom: | ||
line_edit.textbox.setDisabled(True) | ||
if not self.isVisible(): | ||
line_edit.setVisible(False) | ||
|
||
cs_layout = QVBoxLayout() | ||
cs_layout.addLayout(name_layout) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
color_theme
->ui_theme