From bd826c14ac03aecd0c028d89aaa26c9a77cd87bc Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Tue, 16 Sep 2025 10:45:54 -0400 Subject: [PATCH] refactor out theme object --- config/Theme.qml | 34 ++++------------------------------ config/theme/Theme.qml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 30 deletions(-) create mode 100644 config/theme/Theme.qml diff --git a/config/Theme.qml b/config/Theme.qml index bd09368..31ee7c2 100644 --- a/config/Theme.qml +++ b/config/Theme.qml @@ -1,6 +1,7 @@ pragma Singleton pragma ComponentBehavior: Bound +import "theme" import QtQuick import Quickshell import Quickshell.Io @@ -8,10 +9,11 @@ import Quickshell.Io Singleton { id: root - property var palette: theme.palette + property var palette: theme property alias themes: cache.themes property alias currentTheme: cache.current + property int currentThemeIndex: themes.indexOf(currentTheme) Process { running: true @@ -61,36 +63,8 @@ Singleton { // when changes are made to properties in the adapter, save them onAdapterUpdated: writeAdapter() - JsonAdapter { + Theme { id: theme - - property JsonObject palette: JsonObject { - property color primary: "#605dff" - property color primarycontent: "#edf1fe" - property color secondary: "#f43098" - property color secondarycontent: "#f9e4f0" - property color accent: "#00d3bb" - property color accentcontent: "#084d49" - property color neutral: "#09090b" - property color neutralcontent: "#e4e4e7" - property color base100: "#1d232a" - property color base200: "#191e24" - property color base300: "#15191e" - property color basecontent: "#ecf9ff" - property color info: "#00bafe" - property color infocontent: "#042e49" - property color success: "#00d390" - property color successcontent: "#004c39" - property color warning: "#fcb700" - property color warningcontent: "#793205" - property color error: "#ff627d" - property color errorcontent: "#4d0218" - - property int radiusSelector: 8 - property int radiusField: 8 - property int radiusBox: 8 - property int border: 2 - } } } } diff --git a/config/theme/Theme.qml b/config/theme/Theme.qml new file mode 100644 index 0000000..0f08a88 --- /dev/null +++ b/config/theme/Theme.qml @@ -0,0 +1,30 @@ +import QtQuick +import Quickshell.Io + +JsonAdapter { + property color primary: "#605dff" + property color primarycontent: "#edf1fe" + property color secondary: "#f43098" + property color secondarycontent: "#f9e4f0" + property color accent: "#00d3bb" + property color accentcontent: "#084d49" + property color neutral: "#09090b" + property color neutralcontent: "#e4e4e7" + property color base100: "#1d232a" + property color base200: "#191e24" + property color base300: "#15191e" + property color basecontent: "#ecf9ff" + property color info: "#00bafe" + property color infocontent: "#042e49" + property color success: "#00d390" + property color successcontent: "#004c39" + property color warning: "#fcb700" + property color warningcontent: "#793205" + property color error: "#ff627d" + property color errorcontent: "#4d0218" + + property int radiusSelector: 8 + property int radiusField: 8 + property int radiusBox: 8 + property int border: 2 +}