diff --git a/picard/ui/colors.py b/picard/ui/colors.py index d20854859..9eae48253 100644 --- a/picard/ui/colors.py +++ b/picard/ui/colors.py @@ -52,6 +52,13 @@ _COLOR_DESCRIPTIONS = { 'tagstatus_added': N_("Tag added"), 'tagstatus_changed': N_("Tag changed"), 'tagstatus_removed': N_("Tag removed"), + 'syntax_hl_error': N_("Error syntax highlight"), + 'syntax_hl_escape': N_("Escape syntax highlight"), + 'syntax_hl_func': N_("Function syntax highlight"), + 'syntax_hl_noop': N_("Noop syntax highlight"), + 'syntax_hl_special': N_("Special syntax highlight"), + 'syntax_hl_unicode': N_("Unicode syntax highlight"), + 'syntax_hl_var': N_("Variable syntax highlight"), } @@ -97,6 +104,22 @@ register_color(_DARK, 'row_highlight', '#90907E') register_color(_LIGHT, 'first_cover_hl', 'darkgoldenrod') register_color(_DARK, 'first_cover_hl', 'orange') +# syntax highlighting colors +register_color(_LIGHT, 'syntax_hl_error', 'blue') +register_color(_LIGHT, 'syntax_hl_escape', 'darkRed') +register_color(_LIGHT, 'syntax_hl_func', 'blue') +register_color(_LIGHT, 'syntax_hl_noop', 'darkGray') +register_color(_LIGHT, 'syntax_hl_special', 'blue') +register_color(_LIGHT, 'syntax_hl_unicode', 'darkRed') +register_color(_LIGHT, 'syntax_hl_var', 'darkCyan') +register_color(_DARK, 'syntax_hl_error', '#FF57A0') +register_color(_DARK, 'syntax_hl_escape', '#4BEF1F') +register_color(_DARK, 'syntax_hl_func', '#FF57A0') +register_color(_DARK, 'syntax_hl_noop', '#04E7D5') +register_color(_DARK, 'syntax_hl_special', '#FF57A0') +register_color(_DARK, 'syntax_hl_unicode', '#4BEF1F') +register_color(_DARK, 'syntax_hl_var', '#FCBB51') + class InterfaceColors: diff --git a/picard/ui/theme.py b/picard/ui/theme.py index 93d5f8646..0ae2705f3 100644 --- a/picard/ui/theme.py +++ b/picard/ui/theme.py @@ -21,7 +21,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -from collections import namedtuple from enum import Enum from PyQt6 import ( @@ -73,24 +72,6 @@ if IS_WIN or IS_MACOS: elif not IS_HAIKU: AVAILABLE_UI_THEMES.extend([UiTheme.SYSTEM]) -SyntaxTheme = namedtuple('SyntaxTheme', 'func var escape special noop') - -light_syntax_theme = SyntaxTheme( - func=QtGui.QColor(QtCore.Qt.GlobalColor.blue), - var=QtGui.QColor(QtCore.Qt.GlobalColor.darkCyan), - escape=QtGui.QColor(QtCore.Qt.GlobalColor.darkRed), - special=QtGui.QColor(QtCore.Qt.GlobalColor.blue), - noop=QtGui.QColor(QtCore.Qt.GlobalColor.darkGray), -) - -dark_syntax_theme = SyntaxTheme( - func=QtGui.QColor(255, 87, 160, 255), # magenta - var=QtGui.QColor(252, 187, 81, 255), # orange - escape=QtGui.QColor(75, 239, 31, 255), # green - special=QtGui.QColor(255, 87, 160, 255), # magenta - noop=QtGui.QColor(4, 231, 213, 255), # cyan -) - class MacOverrideStyle(QtWidgets.QProxyStyle): """Override the default style to fix some platform specific issues""" @@ -144,10 +125,6 @@ class BaseTheme: def accent_color(self): # pylint: disable=no-self-use return None - @property - def syntax_theme(self): - return dark_syntax_theme if self.is_dark_theme else light_syntax_theme - # pylint: disable=no-self-use def update_palette(self, palette, dark_theme, accent_color): if accent_color: diff --git a/picard/ui/widgets/scriptdocumentation.py b/picard/ui/widgets/scriptdocumentation.py index 25be0e596..d02e8f5e6 100644 --- a/picard/ui/widgets/scriptdocumentation.py +++ b/picard/ui/widgets/scriptdocumentation.py @@ -31,7 +31,7 @@ from picard.i18n import gettext as _ from picard.script import script_function_documentation_all from picard.ui import FONT_FAMILY_MONOSPACE -from picard.ui.theme import theme +from picard.ui.colors import interface_colors DOCUMENTATION_HTML_TEMPLATE = ''' @@ -97,7 +97,7 @@ class ScriptingDocumentationWidget(QtWidgets.QWidget): html = DOCUMENTATION_HTML_TEMPLATE % { 'html': "