summaryrefslogtreecommitdiff
path: root/modules/controlcenter/appearance/sections/ColorVariantSection.qml
diff options
context:
space:
mode:
authorATMDA <atdma2600@gmail.com>2025-11-19 22:18:10 -0500
committerATMDA <atdma2600@gmail.com>2025-11-19 22:18:10 -0500
commitbf3a1781d12271a7edb9ead26eb59740f87877fd (patch)
tree9e4291b5386cdf4905e1c60970e08d7cf85ac9c1 /modules/controlcenter/appearance/sections/ColorVariantSection.qml
parentrefactor: replaced input fields with SliderInput components (diff)
downloadcaelestia-shell-bf3a1781d12271a7edb9ead26eb59740f87877fd.tar.gz
caelestia-shell-bf3a1781d12271a7edb9ead26eb59740f87877fd.tar.bz2
caelestia-shell-bf3a1781d12271a7edb9ead26eb59740f87877fd.zip
refactor: reorganized AppearancePane sections into dedicated components
Diffstat (limited to 'modules/controlcenter/appearance/sections/ColorVariantSection.qml')
-rw-r--r--modules/controlcenter/appearance/sections/ColorVariantSection.qml92
1 files changed, 92 insertions, 0 deletions
diff --git a/modules/controlcenter/appearance/sections/ColorVariantSection.qml b/modules/controlcenter/appearance/sections/ColorVariantSection.qml
new file mode 100644
index 0000000..98c3d7c
--- /dev/null
+++ b/modules/controlcenter/appearance/sections/ColorVariantSection.qml
@@ -0,0 +1,92 @@
+pragma ComponentBehavior: Bound
+
+import ".."
+import "../../../launcher/services"
+import qs.components
+import qs.components.controls
+import qs.components.containers
+import qs.services
+import qs.config
+import Quickshell
+import QtQuick
+import QtQuick.Layouts
+
+CollapsibleSection {
+ title: qsTr("Color variant")
+ description: qsTr("Material theme variant")
+ showBackground: true
+
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: Appearance.spacing.small / 2
+
+ Repeater {
+ model: M3Variants.list
+
+ delegate: StyledRect {
+ required property var modelData
+
+ Layout.fillWidth: true
+
+ color: Qt.alpha(Colours.tPalette.m3surfaceContainer, modelData.variant === Schemes.currentVariant ? Colours.tPalette.m3surfaceContainer.a : 0)
+ radius: Appearance.rounding.normal
+ border.width: modelData.variant === Schemes.currentVariant ? 1 : 0
+ border.color: Colours.palette.m3primary
+
+ StateLayer {
+ function onClicked(): void {
+ const variant = modelData.variant;
+
+ Schemes.currentVariant = variant;
+ Quickshell.execDetached(["caelestia", "scheme", "set", "-v", variant]);
+
+ Qt.callLater(() => {
+ reloadTimer.restart();
+ });
+ }
+ }
+
+ Timer {
+ id: reloadTimer
+ interval: 300
+ onTriggered: {
+ Schemes.reload();
+ }
+ }
+
+ RowLayout {
+ id: variantRow
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.margins: Appearance.padding.normal
+
+ spacing: Appearance.spacing.normal
+
+ MaterialIcon {
+ text: modelData.icon
+ font.pointSize: Appearance.font.size.large
+ fill: modelData.variant === Schemes.currentVariant ? 1 : 0
+ }
+
+ StyledText {
+ Layout.fillWidth: true
+ text: modelData.name
+ font.weight: modelData.variant === Schemes.currentVariant ? 500 : 400
+ }
+
+ MaterialIcon {
+ visible: modelData.variant === Schemes.currentVariant
+ text: "check"
+ color: Colours.palette.m3primary
+ font.pointSize: Appearance.font.size.large
+ }
+ }
+
+ implicitHeight: variantRow.implicitHeight + Appearance.padding.normal * 2
+ }
+ }
+ }
+}
+