Improve welcome dialog and add more theme colour options (#2380)

This commit is contained in:
Veronica Berglyd Olsen
2025-06-04 22:27:07 +02:00
committed by GitHub
24 changed files with 173 additions and 155 deletions
+43 -40
View File
@@ -59,24 +59,24 @@ A colour theme ``.conf`` file consists of the following settings:
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/ licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
[Base] [Base]
default = #303030 default = #303030
faded = #6c6c6c faded = #6c6c6c
red = #a62a2d red = #a62a2d
orange = #b36829 orange = #b36829
yellow = #a68542 yellow = #a68542
green = #296629 green = #296629
cyan = #269999 cyan = #269999
blue = #3a70a6 blue = #3a70a6
purple = #b35ab3 purple = #b35ab3
[Project] [Project]
root = blue root = blue
folder = yellow folder = yellow
file = default file = default
title = green title = green
chapter = red chapter = red
scene = blue scene = blue
note = yellow note = yellow
[Palette] [Palette]
window = #efefef window = #efefef
@@ -95,31 +95,31 @@ A colour theme ``.conf`` file consists of the following settings:
linkvisited = blue linkvisited = blue
[GUI] [GUI]
helptext = #5c5c5c helptext = #5c5c5c
fadedtext = #6c6c6c fadedtext = #6c6c6c
errortext = red errortext = red
[Syntax] [Syntax]
background = #ffffff background = #ffffff
text = #000000 text = #000000
link = blue link = blue
headertext = green headertext = green
headertag = green:160 headertag = green:L135
emphasis = orange emphasis = orange
dialog = blue dialog = blue
altdialog = blue altdialog = blue
note = yellow note = yellow
hidden = faded hidden = faded
shortcode = green shortcode = green
keyword = red keyword = red
tag = green tag = green
value = blue value = blue
optional = green optional = green
spellcheckline = red spellcheckline = red
errorline = green errorline = green
replacetag = green replacetag = green
modifier = green modifier = green
texthighlight = #c8c80060 texthighlight = #c8c80060
Theme Sections Theme Sections
@@ -149,12 +149,15 @@ There are several ways to enter colour values:
.. csv-table:: Colour Formats .. csv-table:: Colour Formats
:header: "Syntax", "Description" :header: "Syntax", "Description"
:widths: 15, 85
:class: "tight-table" :class: "tight-table"
"``#RRGGBB``", "A CSS style hexadecimal values, like ``#ff0000`` for red." "``#RRGGBB``", "A CSS style hexadecimal values, like ``#ff0000`` for red."
"``#RRGGBBAA``", "A CSS style hexadecimal values with transparency, like ``#ff00007f`` for half-transparent red." "``#RRGGBBAA``", "A CSS style hexadecimal values with transparency, like ``#ff00007f`` for half-transparent red."
"``name``", "A name referring to one of the colours already specified under the ``[Base]`` section, like ``red``. Note that you should not use named colours in the ``[Base]`` section itself as that may have unintended results." "``name``", "A name referring to one of the colours already specified under the ``[Base]`` section, like ``red``. Note that you should not use named colours in the ``[Base]`` section itself as that may have unintended results."
"``name:alpha``", "A name referring to one of the colours already specified under the ``[Base]`` section, with a transparency value added. The alpha value must be in the range ``0`` to ``255``, like ``red:127`` for half-transparent red." "``name:255``", "A name referring to one of the colours already specified under the ``[Base]`` section, with a transparency value added. The value must be in the range ``0`` to ``255``, like ``red:127`` for half-transparent red."
"``name:L100``", "A name referring to one of the colours already specified under the ``[Base]`` section, where the L-number is a percentage value that makes it lighter. The value must be greater than ``0``. ``L100`` means no change."
"``name:D100``", "A name referring to one of the colours already specified under the ``[Base]`` section, where the D-number is a percentage value that makes it darker. The value must be greater than ``0``. ``D100`` means no change."
"``r, g, b``", "A set of red, green and blue numbers in the range ``0`` to ``255``, like ``255, 0, 0`` for red." "``r, g, b``", "A set of red, green and blue numbers in the range ``0`` to ``255``, like ``255, 0, 0`` for red."
"``r, g, b, a``", "A set of red, green, blue and alpha numbers in the range ``0`` to ``255``, like ``255, 0, 0, 127`` for half-transparent red." "``r, g, b, a``", "A set of red, green, blue and alpha numbers in the range ``0`` to ``255``, like ``255, 0, 0, 127`` for half-transparent red."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

+1 -1
View File
@@ -54,7 +54,7 @@ background = #363636
text = default text = default
link = blue link = blue
headertext = green headertext = green
headertag = green:160 headertag = green:D150
emphasis = orange emphasis = orange
dialog = blue dialog = blue
altdialog = blue altdialog = blue
+1 -1
View File
@@ -54,7 +54,7 @@ background = #ffffff
text = #000000 text = #000000
link = blue link = blue
headertext = green headertext = green
headertag = green:160 headertag = green:L135
emphasis = orange emphasis = orange
dialog = blue dialog = blue
altdialog = blue altdialog = blue
+2 -2
View File
@@ -70,7 +70,7 @@ background = #282a36
text = #f8f8f2 text = #f8f8f2
link = #ff79c6 link = #ff79c6
headertext = purple headertext = purple
headertag = #bd93f9a0 headertag = purple:D150
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
@@ -85,4 +85,4 @@ spellcheckline = red
errorline = green errorline = green
replacetag = yellow replacetag = yellow
modifier = cyan modifier = cyan
texthighlight = #f1fa8c60 texthighlight = yellow:96
+17 -17
View File
@@ -8,7 +8,7 @@ license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/ licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
[Base] [Base]
default = #cccccc default = #c8c8c8
faded = #949494 faded = #949494
red = #f2777a red = #f2777a
orange = #f99139 orange = #f99139
@@ -44,28 +44,28 @@ link = blue
linkvisited = blue linkvisited = blue
[GUI] [GUI]
helptext = #a4a4a4 helptext = default:D120
fadedtext = faded fadedtext = faded
errortext = red errortext = red
[Syntax] [Syntax]
background = #363636 background = #363636
text = #c8c8c8 text = default
link = #c8c8c8 link = default
headertext = #e1e1e1 headertext = default:L115
headertag = #e1e1e1a0 headertag = default:D125
emphasis = #c8c8c8 emphasis = default
dialog = #c8c8c8 dialog = default
altdialog = #c8c8c8 altdialog = default
note = #c8c8c8 note = default
hidden = faded hidden = faded
shortcode = #e1e1e1 shortcode = default:L115
keyword = #e1e1e1 keyword = default:L115
tag = #c8c8c8 tag = default
value = #c8c8c8 value = default
optional = #e1e1e1 optional = default:L115
spellcheckline = red spellcheckline = red
errorline = green errorline = green
replacetag = #e1e1e1 replacetag = default:L115
modifier = #e1e1e1 modifier = default:L115
texthighlight = #ffffff40 texthighlight = #ffffff40
+17 -17
View File
@@ -8,7 +8,7 @@ license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/ licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
[Base] [Base]
default = #303030 default = #282828
faded = #6c6c6c faded = #6c6c6c
red = #a62a2d red = #a62a2d
orange = #b36829 orange = #b36829
@@ -44,28 +44,28 @@ link = blue
linkvisited = blue linkvisited = blue
[GUI] [GUI]
helptext = #5c5c5c helptext = default:L225
fadedtext = faded fadedtext = faded
errortext = red errortext = red
[Syntax] [Syntax]
background = #ffffff background = #ffffff
text = #141414 text = default
link = #141414 link = default
headertext = #000000 headertext = default:D200
headertag = #000000a0 headertag = default:L400
emphasis = #141414 emphasis = default
dialog = #141414 dialog = default
altdialog = #141414 altdialog = default
note = #141414 note = default
hidden = faded hidden = faded
shortcode = #000000 shortcode = default:D200
keyword = #000000 keyword = default:D200
tag = #141414 tag = default
value = #141414 value = default
optional = #000000 optional = default:D200
spellcheckline = red spellcheckline = red
errorline = green errorline = green
replacetag = #000000 replacetag = default:D200
modifier = #000000 modifier = default:D200
texthighlight = #00000040 texthighlight = #00000040
+1 -1
View File
@@ -77,7 +77,7 @@ headertag = blue:160
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
note = #80764b note = yellow:D175
hidden = faded hidden = faded
shortcode = blue shortcode = blue
keyword = red keyword = red
+2 -2
View File
@@ -32,7 +32,7 @@ default = #d6deeb
faded = #637777 faded = #637777
red = #f78c6c red = #f78c6c
orange = #ecc48d orange = #ecc48d
yellow = #addb67 yellow = #ffeb95
green = #addb67 green = #addb67
cyan = #7fdbca cyan = #7fdbca
blue = #82aaff blue = #82aaff
@@ -77,7 +77,7 @@ headertag = blue:160
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
note = #fff9ca note = yellow:L115
hidden = faded hidden = faded
shortcode = blue shortcode = blue
keyword = red keyword = red
+4 -4
View File
@@ -66,12 +66,12 @@ background = #fafbfc
text = default text = default
link = blue link = blue
headertext = green headertext = green
headertag = #2dae58a0 headertag = green:D125
emphasis = purple emphasis = purple
dialog = blue dialog = blue
altdialog = yellow altdialog = yellow
note = #78bbb9 note = cyan
hidden = #9194a2 hidden = purple:D150
shortcode = purple shortcode = purple
keyword = blue keyword = blue
tag = green tag = green
@@ -81,4 +81,4 @@ spellcheckline = red
errorline = green errorline = green
replacetag = cyan replacetag = cyan
modifier = purple modifier = purple
texthighlight = #cf9c0060 texthighlight = yellow:96
@@ -58,12 +58,12 @@ button = #073642
buttontext = default buttontext = default
brighttext = #073642 brighttext = #073642
highlight = cyan highlight = cyan
highlightedtext = #002b36 highlightedtext = default
link = blue link = blue
linkvisited = blue linkvisited = blue
[GUI] [GUI]
helptext = purple helptext = cyan
fadedtext = faded fadedtext = faded
errortext = red errortext = red
@@ -71,18 +71,18 @@ errortext = red
background = #073642 background = #073642
text = default text = default
link = blue link = blue
headertext = default:196 headertext = default:D125
headertag = cyan headertag = cyan
emphasis = blue emphasis = blue
dialog = cyan dialog = cyan
altdialog = cyan altdialog = cyan
note = cyan:196 note = cyan:L115
hidden = default:196 hidden = default:D150
shortcode = yellow shortcode = yellow
keyword = green keyword = green
tag = orange tag = orange
value = orange value = orange
optional = cyan:196 optional = cyan:L115
spellcheckline = orange spellcheckline = orange
errorline = red errorline = red
replacetag = green replacetag = green
@@ -59,12 +59,12 @@ button = #eee8d5
buttontext = default buttontext = default
brighttext = #eee8d5 brighttext = #eee8d5
highlight = cyan highlight = cyan
highlightedtext = #fdf6e3 highlightedtext = default
link = blue link = blue
linkvisited = blue linkvisited = blue
[GUI] [GUI]
helptext = purple helptext = cyan
fadedtext = faded fadedtext = faded
errortext = red errortext = red
@@ -72,18 +72,18 @@ errortext = red
background = #eee8d5 background = #eee8d5
text = default text = default
link = blue link = blue
headertext = default:196 headertext = default:L125
headertag = cyan headertag = cyan
emphasis = blue emphasis = blue
dialog = cyan dialog = cyan
altdialog = cyan altdialog = cyan
note = cyan:196 note = cyan:D125
hidden = default:196 hidden = default:L200
shortcode = yellow shortcode = yellow
keyword = green keyword = green
tag = orange tag = orange
value = orange value = orange
optional = cyan:196 optional = cyan:D125
spellcheckline = orange spellcheckline = orange
errorline = red errorline = red
replacetag = green replacetag = green
+4 -4
View File
@@ -41,20 +41,20 @@ note = yellow
window = #555753 window = #555753
windowtext = default windowtext = default
base = #2e3436 base = #2e3436
alternatebase = #888a85 alternatebase = #454e51
text = default text = default
tooltipbase = #ffffc0 tooltipbase = #ffffc0
tooltiptext = #15150d tooltiptext = #15150d
button = #555753 button = #555753
buttontext = default buttontext = default
brighttext = #555753 brighttext = #555753
highlight = #2c98f7 highlight = blue
highlightedtext = #ffffff highlightedtext = #ffffff
link = blue link = blue
linkvisited = blue linkvisited = blue
[GUI] [GUI]
helptext = #e9b96e helptext = orange
fadedtext = faded fadedtext = faded
errortext = red errortext = red
@@ -67,7 +67,7 @@ headertag = blue:160
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
note = #fcf2a4 note = yellow:L115
hidden = faded hidden = faded
shortcode = blue shortcode = blue
keyword = red keyword = red
+3 -3
View File
@@ -48,13 +48,13 @@ tooltiptext = #15150d
button = #d3d7cf button = #d3d7cf
buttontext = default buttontext = default
brighttext = #d3d7cf brighttext = #d3d7cf
highlight = #3087c6 highlight = blue:L200
highlightedtext = #ffffff highlightedtext = #ffffff
link = blue link = blue
linkvisited = blue linkvisited = blue
[GUI] [GUI]
helptext = #8f5902 helptext = orange
fadedtext = faded fadedtext = faded
errortext = red errortext = red
@@ -67,7 +67,7 @@ headertag = blue:160
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
note = #a78800 note = yellow:D125
hidden = faded hidden = faded
shortcode = blue shortcode = blue
keyword = red keyword = red
+1 -1
View File
@@ -73,7 +73,7 @@ background = #ffffff
text = #4d4d4c text = #4d4d4c
link = blue link = blue
headertext = blue headertext = blue
headertag = blue:160 headertag = blue:L135
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
@@ -73,7 +73,7 @@ background = #1d1f21
text = default text = default
link = blue link = blue
headertext = blue headertext = blue
headertag = blue:160 headertag = blue:D150
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
@@ -73,7 +73,7 @@ background = #002451
text = default text = default
link = blue link = blue
headertext = blue headertext = blue
headertag = blue:160 headertag = blue:D150
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
@@ -73,7 +73,7 @@ background = #000000
text = default text = default
link = blue link = blue
headertext = blue headertext = blue
headertag = blue:160 headertag = blue:D150
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
@@ -73,7 +73,7 @@ background = #2d2d2d
text = default text = default
link = blue link = blue
headertext = blue headertext = blue
headertag = blue:160 headertag = blue:D150
emphasis = orange emphasis = orange
dialog = green dialog = green
altdialog = yellow altdialog = yellow
+33 -28
View File
@@ -244,32 +244,6 @@ class GuiTheme:
window = palette.window().color() window = palette.window().color()
return text.lightnessF() > window.lightnessF() return text.lightnessF() > window.lightnessF()
def parseColor(self, value: str, default: QColor = QtBlack) -> QColor:
"""Parse a string as a colour value."""
if value in self._qColors:
# Named colour
return self._qColors[value]
elif value.startswith("#") and len(value) == 7:
# Assume #RRGGBB
return QColor.fromString(value)
elif value.startswith("#") and len(value) == 9:
# Assume #RRGGBBAA and convert to #AARRGGBB
return QColor.fromString(f"#{value[7:9]}{value[1:7]}")
elif ":" in value:
# Colour name and alpha
name, _, alpha = value.partition(":")
color = QColor(self._qColors.get(name.strip(), default))
color.setAlpha(checkInt(alpha, 255))
return color
elif "," in value:
# Integer red, green, blue, alpha
data = value.split(",")
result = [0, 0, 0, 255]
for i in range(min(len(data), 4)):
result[i] = checkInt(data[i].strip(), result[i])
return QColor(*result)
return default
def loadTheme(self, force: bool = False) -> bool: def loadTheme(self, force: bool = False) -> bool:
"""Load the currently specified GUI theme. The boolean return """Load the currently specified GUI theme. The boolean return
can be used to determine if the GUI needs refreshing. can be used to determine if the GUI needs refreshing.
@@ -489,6 +463,37 @@ class GuiTheme:
# Internal Functions # Internal Functions
## ##
def _parseColor(self, value: str, default: QColor = QtBlack) -> QColor:
"""Parse a string as a colour value."""
if value in self._qColors:
# Named colour
return self._qColors[value]
elif value.startswith("#") and len(value) == 7:
# Assume #RRGGBB
return QColor.fromString(value)
elif value.startswith("#") and len(value) == 9:
# Assume #RRGGBBAA and convert to #AARRGGBB
return QColor.fromString(f"#{value[7:9]}{value[1:7]}")
elif ":" in value:
# Colour name and alpha
name, _, adjust = value.partition(":")
color = QColor(self._qColors.get(name.strip(), default))
if adjust.startswith("L"):
color = color.lighter(checkInt(adjust[1:], 100))
elif adjust.startswith("D"):
color = color.darker(checkInt(adjust[1:], 100))
else:
color.setAlpha(checkInt(adjust, 255))
return color
elif "," in value:
# Integer red, green, blue, alpha
data = value.split(",")
result = [0, 0, 0, 255]
for i in range(min(len(data), 4)):
result[i] = checkInt(data[i].strip(), result[i])
return QColor(*result)
return default
def _setBaseColor(self, key: str, color: QColor) -> None: def _setBaseColor(self, key: str, color: QColor) -> None:
"""Set the colour for a named colour.""" """Set the colour for a named colour."""
self._qColors[key] = QColor(color) self._qColors[key] = QColor(color)
@@ -544,7 +549,7 @@ class GuiTheme:
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"))
def _setPalette( def _setPalette(
self, parser: ConfigParser, section: str, name: str, value: QPalette.ColorRole self, parser: ConfigParser, section: str, name: str, value: QPalette.ColorRole
@@ -634,7 +639,7 @@ class GuiIcons:
"unfold": ("unfold-show", "unfold-hide"), "unfold": ("unfold-show", "unfold-hide"),
} }
IMAGE_MAP: Final[dict[str, tuple[str, str]]] = { IMAGE_MAP: Final[dict[str, tuple[str, str]]] = {
"welcome": ("welcome-light.jpg", "welcome-dark.jpg"), "welcome": ("welcome.webp", "welcome.webp"),
"nw-text": ("novelwriter-text-light.svg", "novelwriter-text-dark.svg"), "nw-text": ("novelwriter-text-light.svg", "novelwriter-text-dark.svg"),
} }
+2 -3
View File
@@ -32,7 +32,7 @@ from PyQt6.QtCore import (
QAbstractListModel, QModelIndex, QObject, QPoint, QSize, Qt, pyqtSignal, QAbstractListModel, QModelIndex, QObject, QPoint, QSize, Qt, pyqtSignal,
pyqtSlot pyqtSlot
) )
from PyQt6.QtGui import QAction, QCloseEvent, QColor, QFont, QPainter, QPaintEvent, QPen, QShortcut from PyQt6.QtGui import QAction, QCloseEvent, QFont, QPainter, QPaintEvent, QPen, QShortcut
from PyQt6.QtWidgets import ( from PyQt6.QtWidgets import (
QApplication, QFileDialog, QFormLayout, QHBoxLayout, QLabel, QLineEdit, QApplication, QFileDialog, QFormLayout, QHBoxLayout, QLabel, QLineEdit,
QListView, QMenu, QPushButton, QScrollArea, QStackedWidget, QListView, QMenu, QPushButton, QScrollArea, QStackedWidget,
@@ -77,7 +77,6 @@ class GuiWelcome(NDialog):
self.bgImage = SHARED.theme.getDecoration("welcome") self.bgImage = SHARED.theme.getDecoration("welcome")
self.nwImage = SHARED.theme.getDecoration("nw-text", h=36) self.nwImage = SHARED.theme.getDecoration("nw-text", h=36)
self.bgColor = QColor(54, 54, 54) if SHARED.theme.isDarkTheme else QColor(255, 255, 255)
self.nwLogo = QLabel(self) self.nwLogo = QLabel(self)
self.nwLogo.setPixmap(SHARED.theme.getPixmap("novelwriter", (128, 128))) self.nwLogo.setPixmap(SHARED.theme.getPixmap("novelwriter", (128, 128)))
@@ -178,8 +177,8 @@ class GuiWelcome(NDialog):
hPix = min(hWin, 600) hPix = min(hWin, 600)
tMode = Qt.TransformationMode.SmoothTransformation tMode = Qt.TransformationMode.SmoothTransformation
painter = QPainter(self) painter = QPainter(self)
painter.fillRect(self.rect(), self.bgColor)
painter.drawPixmap(0, hWin - hPix, self.bgImage.scaledToHeight(hPix, tMode)) painter.drawPixmap(0, hWin - hPix, self.bgImage.scaledToHeight(hPix, tMode))
painter.end()
super().paintEvent(event) super().paintEvent(event)
return return
+26 -15
View File
@@ -52,29 +52,40 @@ def testGuiTheme_ParseColor():
theme._qColors["red"] = QColor(255, 0, 0) theme._qColors["red"] = QColor(255, 0, 0)
theme._qColors["green"] = QColor(0, 255, 0) theme._qColors["green"] = QColor(0, 255, 0)
theme._qColors["blue"] = QColor(0, 0, 255) theme._qColors["blue"] = QColor(0, 0, 255)
theme._qColors["grey"] = QColor(127, 127, 127)
# By Name # By Name
assert theme.parseColor("red").getRgb() == (255, 0, 0, 255) assert theme._parseColor("red").getRgb() == (255, 0, 0, 255)
assert theme.parseColor("green").getRgb() == (0, 255, 0, 255) assert theme._parseColor("green").getRgb() == (0, 255, 0, 255)
assert theme.parseColor("blue").getRgb() == (0, 0, 255, 255) assert theme._parseColor("blue").getRgb() == (0, 0, 255, 255)
assert theme.parseColor("bob").getRgb() == (0, 0, 0, 255) assert theme._parseColor("bob").getRgb() == (0, 0, 0, 255)
# CSS Format # CSS Format
assert theme.parseColor("#ff0000").getRgb() == (255, 0, 0, 255) assert theme._parseColor("#ff0000").getRgb() == (255, 0, 0, 255)
assert theme.parseColor("#ff00007f").getRgb() == (255, 0, 0, 127) assert theme._parseColor("#ff00007f").getRgb() == (255, 0, 0, 127)
assert theme.parseColor("#ff00").getRgb() == (0, 0, 0, 255) # Too short -> ignored assert theme._parseColor("#ff00").getRgb() == (0, 0, 0, 255) # Too short -> ignored
assert theme.parseColor("#ff00007f15").getRgb() == (0, 0, 0, 255) # Too long -> ignored assert theme._parseColor("#ff00007f15").getRgb() == (0, 0, 0, 255) # Too long -> ignored
# Name + Alpha # Name + Alpha
assert theme.parseColor("red:255").getRgb() == (255, 0, 0, 255) assert theme._parseColor("red:255").getRgb() == (255, 0, 0, 255)
assert theme.parseColor("red:127").getRgb() == (255, 0, 0, 127) assert theme._parseColor("red:127").getRgb() == (255, 0, 0, 127)
assert theme.parseColor("red:512").getRgb() == (255, 0, 0, 255) # Value truncated assert theme._parseColor("red:512").getRgb() == (255, 0, 0, 255) # Value truncated
# Name + Lighter
assert theme._parseColor("grey:L100").getRgb() == (127, 127, 127, 255)
assert theme._parseColor("grey:L150").getRgb() == (190, 190, 190, 255)
assert theme._parseColor("grey:L50").getRgb() == (63, 63, 63, 255)
# Name + Darker
assert theme._parseColor("grey:D100").getRgb() == (127, 127, 127, 255)
assert theme._parseColor("grey:D150").getRgb() == (85, 85, 85, 255)
assert theme._parseColor("grey:D50").getRgb() == (254, 254, 254, 255)
# Values # Values
assert theme.parseColor("255, 0, 0").getRgb() == (255, 0, 0, 255) assert theme._parseColor("255, 0, 0").getRgb() == (255, 0, 0, 255)
assert theme.parseColor("255, 0, 0, 255").getRgb() == (255, 0, 0, 255) assert theme._parseColor("255, 0, 0, 255").getRgb() == (255, 0, 0, 255)
assert theme.parseColor("255, 0, 0, 127").getRgb() == (255, 0, 0, 127) assert theme._parseColor("255, 0, 0, 127").getRgb() == (255, 0, 0, 127)
assert theme.parseColor("255, 0, 0, 127, 42").getRgb() == (255, 0, 0, 127) # Truncated assert theme._parseColor("255, 0, 0, 127, 42").getRgb() == (255, 0, 0, 127) # Truncated
@pytest.mark.gui @pytest.mark.gui