Fix button colour bug (#2557)
This commit is contained in:
@@ -79,6 +79,27 @@ A colour theme ``.conf`` file consists of the following settings:
|
|||||||
inactive = red
|
inactive = red
|
||||||
disabled = faded
|
disabled = faded
|
||||||
|
|
||||||
|
[Icon]
|
||||||
|
tool = default
|
||||||
|
sidebar = default
|
||||||
|
accept = green
|
||||||
|
reject = red
|
||||||
|
action = blue
|
||||||
|
altaction = orange
|
||||||
|
apply = green
|
||||||
|
create = yellow
|
||||||
|
destroy = faded
|
||||||
|
reset = green
|
||||||
|
add = green
|
||||||
|
change = green
|
||||||
|
remove = red
|
||||||
|
shortcode = default
|
||||||
|
markdown = orange
|
||||||
|
systemio = yellow
|
||||||
|
info = blue
|
||||||
|
warning = orange
|
||||||
|
error = red
|
||||||
|
|
||||||
[Palette]
|
[Palette]
|
||||||
window = base:D105
|
window = base:D105
|
||||||
windowtext = default
|
windowtext = default
|
||||||
@@ -141,6 +162,7 @@ affects.
|
|||||||
"``[Main]``", "Meta data about the theme, You must at least set ``name``, ``mode`` and ``author``, and ``mode`` must be either ``light`` or ``dark``."
|
"``[Main]``", "Meta data about the theme, You must at least set ``name``, ``mode`` and ``author``, and ``mode`` must be either ``light`` or ``dark``."
|
||||||
"``[Base]``", "The base colours of the theme. These are also selectable colours in various places inside the app, like for icon colours in **Preferences**."
|
"``[Base]``", "The base colours of the theme. These are also selectable colours in various places inside the app, like for icon colours in **Preferences**."
|
||||||
"``[Project]``", "The colours used for icons and markers for the different project item types."
|
"``[Project]``", "The colours used for icons and markers for the different project item types."
|
||||||
|
"``[Icon]``", "The colours used for icons and buttons on the user interface. The names correspond to button and icon roles."
|
||||||
"``[Palette]``", "The colours used for styling the user interface. The values correspond to the ColorRole_ values in the Qt library."
|
"``[Palette]``", "The colours used for styling the user interface. The values correspond to the ColorRole_ values in the Qt library."
|
||||||
"``[GUI]``", "The colours used for styling additional elements of the user interface."
|
"``[GUI]``", "The colours used for styling additional elements of the user interface."
|
||||||
"``[Syntax]``", "The colours used for syntax highlighting in documents."
|
"``[Syntax]``", "The colours used for syntax highlighting in documents."
|
||||||
@@ -174,10 +196,10 @@ There are several ways to enter colour values:
|
|||||||
|
|
||||||
.. versionadded:: 2.8
|
.. versionadded:: 2.8
|
||||||
The ``[Syntax]`` section was moved into the main theme file. Previously, these settings were in
|
The ``[Syntax]`` section was moved into the main theme file. Previously, these settings were in
|
||||||
their own file. The ``[Icons]`` section was renamed to ``[Base]``. Added the ``line`` and
|
their own file. The ``[Icons]`` section was renamed to ``[Base]``, and a new ``[Icon]`` section
|
||||||
``whitespace`` settings. Dropped the ``license``, ``licenseurl``, and ``description`` settings.
|
added for button and icon roles. Added the ``line`` and ``whitespace`` settings. Dropped the
|
||||||
The ``author`` field is now required if the theme is included in the app, but not for user
|
``license``, ``licenseurl``, and ``description`` settings. The ``author`` field is now required
|
||||||
themes.
|
if the theme is included in the app, but not for user themes.
|
||||||
|
|
||||||
|
|
||||||
Icon Themes
|
Icon Themes
|
||||||
|
|||||||
@@ -2489,17 +2489,17 @@ class GuiDocToolBar(QWidget):
|
|||||||
palette.setColor(QPalette.ColorRole.Text, syntax.text)
|
palette.setColor(QPalette.ColorRole.Text, syntax.text)
|
||||||
self.setPalette(palette)
|
self.setPalette(palette)
|
||||||
|
|
||||||
self.tbBoldMD.setThemeIcon("fmt_bold", "mdformat")
|
self.tbBoldMD.setThemeIcon("fmt_bold", "markdown")
|
||||||
self.tbItalicMD.setThemeIcon("fmt_italic", "mdformat")
|
self.tbItalicMD.setThemeIcon("fmt_italic", "markdown")
|
||||||
self.tbStrikeMD.setThemeIcon("fmt_strike", "mdformat")
|
self.tbStrikeMD.setThemeIcon("fmt_strike", "markdown")
|
||||||
self.tbMarkMD.setThemeIcon("fmt_mark", "mdformat")
|
self.tbMarkMD.setThemeIcon("fmt_mark", "markdown")
|
||||||
self.tbBold.setThemeIcon("fmt_bold", "scformat")
|
self.tbBold.setThemeIcon("fmt_bold", "shortcode")
|
||||||
self.tbItalic.setThemeIcon("fmt_italic", "scformat")
|
self.tbItalic.setThemeIcon("fmt_italic", "shortcode")
|
||||||
self.tbStrike.setThemeIcon("fmt_strike", "scformat")
|
self.tbStrike.setThemeIcon("fmt_strike", "shortcode")
|
||||||
self.tbUnderline.setThemeIcon("fmt_underline", "scformat")
|
self.tbUnderline.setThemeIcon("fmt_underline", "shortcode")
|
||||||
self.tbMark.setThemeIcon("fmt_mark", "scformat")
|
self.tbMark.setThemeIcon("fmt_mark", "shortcode")
|
||||||
self.tbSuperscript.setThemeIcon("fmt_superscript", "scformat")
|
self.tbSuperscript.setThemeIcon("fmt_superscript", "shortcode")
|
||||||
self.tbSubscript.setThemeIcon("fmt_subscript", "scformat")
|
self.tbSubscript.setThemeIcon("fmt_subscript", "shortcode")
|
||||||
|
|
||||||
|
|
||||||
class GuiDocEditSearch(QFrame):
|
class GuiDocEditSearch(QFrame):
|
||||||
|
|||||||
@@ -249,7 +249,10 @@ class GuiTheme:
|
|||||||
|
|
||||||
def getRawBaseColor(self, name: str) -> bytes:
|
def getRawBaseColor(self, name: str) -> bytes:
|
||||||
"""Return a base color."""
|
"""Return a base color."""
|
||||||
return self._svgColors.get(name, self._svgColors.get("default", b"#000000"))
|
if color := self._svgColors.get(name):
|
||||||
|
return color
|
||||||
|
logger.warning("No colour named '%s'", name)
|
||||||
|
return self._svgColors.get("default", b"#000000")
|
||||||
|
|
||||||
##
|
##
|
||||||
# Theme Methods
|
# Theme Methods
|
||||||
@@ -583,6 +586,8 @@ class GuiTheme:
|
|||||||
self.iconCache.clear()
|
self.iconCache.clear()
|
||||||
self._svgColors = {}
|
self._svgColors = {}
|
||||||
self._qColors = {}
|
self._qColors = {}
|
||||||
|
|
||||||
|
# Base
|
||||||
self._setBaseColor("base", base)
|
self._setBaseColor("base", base)
|
||||||
self._setBaseColor("default", default)
|
self._setBaseColor("default", default)
|
||||||
self._setBaseColor("faded", faded)
|
self._setBaseColor("faded", faded)
|
||||||
@@ -593,6 +598,8 @@ class GuiTheme:
|
|||||||
self._setBaseColor("cyan", cyan)
|
self._setBaseColor("cyan", cyan)
|
||||||
self._setBaseColor("blue", blue)
|
self._setBaseColor("blue", blue)
|
||||||
self._setBaseColor("purple", purple)
|
self._setBaseColor("purple", purple)
|
||||||
|
|
||||||
|
# Project
|
||||||
self._setBaseColor("root", blue)
|
self._setBaseColor("root", blue)
|
||||||
self._setBaseColor("folder", yellow)
|
self._setBaseColor("folder", yellow)
|
||||||
self._setBaseColor("file", default)
|
self._setBaseColor("file", default)
|
||||||
@@ -604,6 +611,27 @@ class GuiTheme:
|
|||||||
self._setBaseColor("inactive", red)
|
self._setBaseColor("inactive", red)
|
||||||
self._setBaseColor("disabled", faded)
|
self._setBaseColor("disabled", faded)
|
||||||
|
|
||||||
|
# Icon
|
||||||
|
self._setBaseColor("tool", default)
|
||||||
|
self._setBaseColor("sidebar", default)
|
||||||
|
self._setBaseColor("accept", green)
|
||||||
|
self._setBaseColor("reject", red)
|
||||||
|
self._setBaseColor("action", blue)
|
||||||
|
self._setBaseColor("altaction", orange)
|
||||||
|
self._setBaseColor("apply", green)
|
||||||
|
self._setBaseColor("create", yellow)
|
||||||
|
self._setBaseColor("destroy", faded)
|
||||||
|
self._setBaseColor("reset", green)
|
||||||
|
self._setBaseColor("add", green)
|
||||||
|
self._setBaseColor("change", green)
|
||||||
|
self._setBaseColor("remove", red)
|
||||||
|
self._setBaseColor("shortcode", default)
|
||||||
|
self._setBaseColor("markdown", orange)
|
||||||
|
self._setBaseColor("systemio", yellow)
|
||||||
|
self._setBaseColor("info", blue)
|
||||||
|
self._setBaseColor("warning", orange)
|
||||||
|
self._setBaseColor("error", red)
|
||||||
|
|
||||||
def _readColor(self, parser: ConfigParser, section: str, name: str) -> QColor:
|
def _readColor(self, parser: ConfigParser, section: str, name: str) -> QColor:
|
||||||
"""Parse a colour value from a config string."""
|
"""Parse a colour value from a config string."""
|
||||||
return self.parseColor(parser.get(section, name, fallback="default"))
|
return self.parseColor(parser.get(section, name, fallback="default"))
|
||||||
|
|||||||
Reference in New Issue
Block a user