Add light/dark mode toggle for matugen

This commit is contained in:
Ly-sec 2025-08-17 12:33:28 +02:00
parent dbdfbdc746
commit 5aeeb8458f
3 changed files with 25 additions and 2 deletions

View file

@ -199,6 +199,7 @@ Singleton {
colorSchemes: JsonObject { colorSchemes: JsonObject {
property bool useWallpaperColors: false property bool useWallpaperColors: false
property string predefinedScheme: "" property string predefinedScheme: ""
property bool darkMode: true
} }
} }
} }

View file

@ -138,6 +138,20 @@ ColumnLayout {
} }
} }
// Dark Mode Toggle
NToggle {
label: "Dark Mode"
description: "Generate dark theme colors when using Matugen. Disable for light theme."
checked: Settings.data.colorSchemes.darkMode
enabled: Settings.data.colorSchemes.useWallpaperColors
onToggled: checked => {
Settings.data.colorSchemes.darkMode = checked
if (Settings.data.colorSchemes.useWallpaperColors) {
ColorSchemeService.changedWallpaper()
}
}
}
NDivider { NDivider {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: Style.marginLarge * scaling Layout.topMargin: Style.marginLarge * scaling
@ -157,7 +171,7 @@ ColumnLayout {
} }
NText { NText {
text: "These color schemes only apply when 'Use Matugen' is disabled. When enabled, Matugen will generate colors based on your wallpaper instead." text: "These color schemes only apply when 'Use Matugen' is disabled. When enabled, Matugen will generate colors based on your wallpaper instead. You can toggle between light and dark themes when using Matugen."
font.pointSize: Style.fontSizeSmall * scaling font.pointSize: Style.fontSizeSmall * scaling
color: Color.mOnSurface color: Color.mOnSurface
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -62,7 +62,15 @@ Singleton {
Process { Process {
id: generateColorsProcess id: generateColorsProcess
command: ["matugen", "image", WallpaperService.currentWallpaper, "--config", Quickshell.shellDir + "/Assets/Matugen/matugen.toml"] command: {
var cmd = ["matugen", "image", WallpaperService.currentWallpaper, "--config", Quickshell.shellDir + "/Assets/Matugen/matugen.toml"]
if (!Settings.data.colorSchemes.darkMode) {
cmd.push("--mode", "light")
} else {
cmd.push("--mode", "dark")
}
return cmd
}
workingDirectory: Quickshell.shellDir workingDirectory: Quickshell.shellDir
running: false running: false
stdout: StdioCollector { stdout: StdioCollector {