Add support for dark theme welcome window

This commit is contained in:
Veronica Berglyd Olsen
2023-12-30 17:23:43 +01:00
parent 05e9729c22
commit df95cd85e8
5 changed files with 7 additions and 10 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 KiB

+2 -3
View File
@@ -255,9 +255,8 @@ class GuiTheme:
backLNess = backCol.lightnessF()
textLNess = textCol.lightnessF()
self.isLightTheme = backLNess > textLNess
if self.helpText == [0, 0, 0]:
self.isLightTheme = backLNess > textLNess
if self.isLightTheme:
helpLCol = textLNess + 0.35*(backLNess - textLNess)
else:
@@ -487,7 +486,7 @@ class GuiIcons:
}
IMAGE_MAP: dict[str, tuple[str, str]] = {
"welcome": ("welcome.jpg", "welcome.jpg"),
"welcome": ("welcome-light.jpg", "welcome-dark.jpg"),
"nw-text": ("novelwriter-text-light.svg", "novelwriter-text-dark.svg"),
}
+5 -7
View File
@@ -82,6 +82,7 @@ class GuiWelcome(QDialog):
self.bgImage = SHARED.theme.loadDecoration("welcome")
self.nwImage = SHARED.theme.loadDecoration("nw-text", h=hD)
self.bgColor = QColor(255, 255, 255) if SHARED.theme.isLightTheme else QColor(54, 54, 54)
self.nwLogo = QLabel()
self.nwLogo.setPixmap(SHARED.theme.getPixmap("novelwriter", (hF, hF)))
@@ -139,6 +140,7 @@ class GuiWelcome(QDialog):
self.outerBox.setContentsMargins(hF, hE, hC, hE)
self.setLayout(self.outerBox)
self.setSizeGripEnabled(True)
logger.debug("Ready: GuiWelcome")
@@ -158,7 +160,7 @@ class GuiWelcome(QDialog):
hPix = min(hWin, 700)
tMode = Qt.TransformationMode.SmoothTransformation
painter = QPainter(self)
painter.fillRect(self.rect(), QColor(255, 255, 255))
painter.fillRect(self.rect(), self.bgColor)
painter.drawPixmap(0, hWin - hPix, self.bgImage.scaledToHeight(hPix, tMode))
super().paintEvent(event)
return
@@ -222,9 +224,6 @@ class _OpenProjectPage(QWidget):
def __init__(self, parent: QWidget) -> None:
super().__init__(parent=parent)
hPx = CONFIG.pxInt(6)
vPx = CONFIG.pxInt(4)
# List View
self.listModel = _ProjectListModel(self)
self.itemDelegate = _ProjectListItem(self)
@@ -239,7 +238,6 @@ class _OpenProjectPage(QWidget):
# Info / Tool
self.selectedPath = QLineEdit(self)
self.selectedPath.setContentsMargins(hPx, vPx, hPx, vPx)
self.selectedPath.setReadOnly(True)
self.keyDelete = QShortcut(self)
@@ -260,8 +258,8 @@ class _OpenProjectPage(QWidget):
baseCol = self.palette().base().color()
self.setStyleSheet((
"QListView {{border: none; background: rgba({r},{g},{b},0.65);}} "
"QLineEdit {{border: none; background: rgba({r},{g},{b},0.65);}} "
).format(r=baseCol.red(), g=baseCol.green(), b=baseCol.blue()))
"QLineEdit {{border: none; background: rgba({r},{g},{b},0.65); padding: {m}px;}} "
).format(r=baseCol.red(), g=baseCol.green(), b=baseCol.blue(), m=CONFIG.pxInt(4)))
return