-
-
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 6 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 |
---|---|---|
|
@@ -40,6 +40,10 @@ | |
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 get_color_scheme | ||
|
||
# Third-party imports | ||
from qtconsole.styles import dark_color | ||
|
||
|
||
HDPI_QT_PAGE = "https://doc.qt.io/qt-5/highdpi.html" | ||
|
@@ -911,7 +915,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,6 +1174,16 @@ def setup_page(self): | |
'selected') | ||
self.schemes_combobox = schemes_combobox_widget.combobox | ||
|
||
|
||
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. Extra linebreak here |
||
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(_('Color theme'), | ||
color_theme_choices, | ||
'color_theme', | ||
restart=True) | ||
|
||
# Layouts | ||
vlayout = QVBoxLayout() | ||
|
||
|
@@ -1181,8 +1194,13 @@ def setup_page(self): | |
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(combo_layout) | ||
buttons_layout.addLayout(color_theme_combo_layout) | ||
buttons_layout.addWidget(edit_button) | ||
buttons_layout.addWidget(self.reset_button) | ||
buttons_layout.addWidget(self.delete_button) | ||
|
@@ -1223,13 +1241,26 @@ 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']) | ||
color_scheme = self.get_option('selected') | ||
color_theme = CONF.get('color_schemes', 'color_theme') | ||
color_scheme = get_color_scheme(color_scheme) | ||
font_color, fon_fw, fon_fs = color_scheme['normal'] | ||
style_sheet = self.main.styleSheet() | ||
if ((not dark_color(font_color) and not style_sheet) | ||
or (dark_color(font_color) and style_sheet) | ||
and color_theme == 'automatic'): | ||
self.changed_options.add('color_theme') | ||
else: | ||
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']) | ||
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. Indent looks offf; if its hanging it should be 4 spaces to the right of the previous line. |
||
if self.main.historylog is not None: | ||
self.main.historylog.apply_plugin_settings( | ||
['color_scheme_name']) | ||
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. See above indent comment. |
||
if self.main.help is not None: | ||
self.main.help.apply_plugin_settings(['color_scheme_name']) | ||
|
||
self.update_combobox() | ||
self.update_preview() | ||
|
||
|
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