From 5aeeb8458f2256c1db05c4a036d39ef6a424c9cd Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Sun, 17 Aug 2025 12:33:28 +0200 Subject: [PATCH] Add light/dark mode toggle for matugen --- Commons/Settings.qml | 1 + Modules/SettingsPanel/Tabs/ColorSchemeTab.qml | 16 +++++++++++++++- Services/ColorSchemeService.qml | 10 +++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 0b1f496..be7f21b 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -199,6 +199,7 @@ Singleton { colorSchemes: JsonObject { property bool useWallpaperColors: false property string predefinedScheme: "" + property bool darkMode: true } } } diff --git a/Modules/SettingsPanel/Tabs/ColorSchemeTab.qml b/Modules/SettingsPanel/Tabs/ColorSchemeTab.qml index e159e32..75f3bce 100644 --- a/Modules/SettingsPanel/Tabs/ColorSchemeTab.qml +++ b/Modules/SettingsPanel/Tabs/ColorSchemeTab.qml @@ -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 { Layout.fillWidth: true Layout.topMargin: Style.marginLarge * scaling @@ -157,7 +171,7 @@ ColumnLayout { } 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 color: Color.mOnSurface Layout.fillWidth: true diff --git a/Services/ColorSchemeService.qml b/Services/ColorSchemeService.qml index 148a05c..2dcab0f 100644 --- a/Services/ColorSchemeService.qml +++ b/Services/ColorSchemeService.qml @@ -62,7 +62,15 @@ Singleton { Process { 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 running: false stdout: StdioCollector {