Add DarkTheme and LightTheme switching

This commit is contained in:
Agel committed 2026-03-31 20:43:37 +02:00
1 parent 7409ba789a
commit ff88cf581b
17 files changed
+206 -73

No files matched your search

+17 -17
View File
@@ -4,9 +4,9 @@ import Asteria
Rectangle {
id: sidebar
width: sidebarOpen ? Theme.sidebarWidth : 0
width: sidebarOpen ? ThemeManager.sidebarWidth : 0
clip: true
color: Theme.surface
color: ThemeManager.currentTheme.surface
property bool sidebarOpen: false
@@ -17,7 +17,7 @@ Rectangle {
Behavior on width {
NumberAnimation {
duration: sidebarOpen ? Theme.animDurationOpen : Theme.animDurationClose
duration: sidebarOpen ? ThemeManager.animDurationOpen : ThemeManager.animDurationClose
easing.type: Easing.OutQuad
}
}
@@ -25,25 +25,25 @@ Rectangle {
Text {
anchors.left: parent.left
anchors.leftMargin: 16
y: Theme.headerHeight / 2 - height / 2
y: ThemeManager.headerHeight / 2 - height / 2
text: "Asteria"
font.pixelSize: 18
font.bold: true
color: Theme.uiText
color: ThemeManager.currentTheme.uiText
}
// Close button aligned with main header row
Button {
anchors.right: parent.right
anchors.rightMargin: 12
y: Theme.headerHeight / 2 - height / 2
y: ThemeManager.headerHeight / 2 - height / 2
z: 1
flat: true
contentItem: Text {
text: "\ue5cb"
font.family: "Material Icons Outlined"
font.pixelSize: 24
color: Theme.sidebarButtonText
color: DarkTheme.sidebarButtonText
}
background: Item {}
onClicked: sidebar.closeDrawer()
@@ -51,8 +51,8 @@ Rectangle {
Column {
id: navColumn
y: Theme.headerHeight
width: Theme.sidebarWidth
y: ThemeManager.headerHeight
width: ThemeManager.sidebarWidth
SideBarButton {
iconText: "\ue86d"
@@ -83,26 +83,26 @@ Rectangle {
Rectangle {
width: parent.width
height: 1
color: Theme.divider
color: ThemeManager.currentTheme.divider
}
SideBarButton {
iconText: "\ue3a9"
title: "Dark Theme"
onClicked: {} // Non-functional
onClicked: ThemeManager.setDarkTheme()
}
SideBarButton {
iconText: "\ue3a6"
title: "Light Theme"
onClicked: {} // Non-functional
onClicked: ThemeManager.setLightTheme()
}
// Divider
Rectangle {
width: parent.width
height: 1
color: Theme.divider
color: ThemeManager.currentTheme.divider
}
SideBarButton {
@@ -123,7 +123,7 @@ Rectangle {
id: tocDivider
width: parent.width
height: 1
color: Theme.divider
color: ThemeManager.currentTheme.divider
}
Text {
@@ -135,7 +135,7 @@ Rectangle {
text: "Contents"
font.pixelSize: 10
font.bold: true
color: Theme.dimText
color: ThemeManager.currentTheme.dimText
font.letterSpacing: 1
}
@@ -162,8 +162,8 @@ Rectangle {
text: modelData.title
font.pixelSize: 13
color: readingModel.currentChapter === modelData.chapterIndex
? Theme.sidebarButtonText
: Theme.uiText
? ThemeManager.sidebarButtonText
: ThemeManager.uiText
elide: Text.ElideRight
wrapMode: Text.NoWrap
}