mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-12 16:52:10 -04:00
widgets: add a button color setting
This commit is contained in:
@@ -134,6 +134,7 @@ Singleton {
|
||||
property string widgetBackgroundColor: "sch"
|
||||
property string widgetColorMode: "default"
|
||||
property string controlCenterTileColorMode: "primary"
|
||||
property string buttonColorMode: "primary"
|
||||
property real cornerRadius: 12
|
||||
property int niriLayoutGapsOverride: -1
|
||||
property int niriLayoutRadiusOverride: -1
|
||||
|
||||
@@ -606,6 +606,58 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
readonly property color buttonBg: {
|
||||
switch (SettingsData.buttonColorMode) {
|
||||
case "primaryContainer":
|
||||
return primaryContainer;
|
||||
case "secondary":
|
||||
return secondary;
|
||||
case "surfaceVariant":
|
||||
return surfaceVariant;
|
||||
default:
|
||||
return primary;
|
||||
}
|
||||
}
|
||||
|
||||
readonly property color buttonText: {
|
||||
switch (SettingsData.buttonColorMode) {
|
||||
case "primaryContainer":
|
||||
return primary;
|
||||
case "secondary":
|
||||
return surfaceText;
|
||||
case "surfaceVariant":
|
||||
return surfaceText;
|
||||
default:
|
||||
return primaryText;
|
||||
}
|
||||
}
|
||||
|
||||
readonly property color buttonHover: {
|
||||
switch (SettingsData.buttonColorMode) {
|
||||
case "primaryContainer":
|
||||
return Qt.rgba(primary.r, primary.g, primary.b, 0.12);
|
||||
case "secondary":
|
||||
return Qt.rgba(surfaceText.r, surfaceText.g, surfaceText.b, 0.12);
|
||||
case "surfaceVariant":
|
||||
return Qt.rgba(surfaceText.r, surfaceText.g, surfaceText.b, 0.12);
|
||||
default:
|
||||
return primaryHover;
|
||||
}
|
||||
}
|
||||
|
||||
readonly property color buttonPressed: {
|
||||
switch (SettingsData.buttonColorMode) {
|
||||
case "primaryContainer":
|
||||
return Qt.rgba(primary.r, primary.g, primary.b, 0.16);
|
||||
case "secondary":
|
||||
return Qt.rgba(surfaceText.r, surfaceText.g, surfaceText.b, 0.16);
|
||||
case "surfaceVariant":
|
||||
return Qt.rgba(surfaceText.r, surfaceText.g, surfaceText.b, 0.16);
|
||||
default:
|
||||
return primaryPressed;
|
||||
}
|
||||
}
|
||||
|
||||
property color shadowMedium: Qt.rgba(0, 0, 0, 0.08)
|
||||
property color shadowStrong: Qt.rgba(0, 0, 0, 0.3)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ var SPEC = {
|
||||
widgetBackgroundColor: { def: "sch" },
|
||||
widgetColorMode: { def: "default" },
|
||||
controlCenterTileColorMode: { def: "primary" },
|
||||
buttonColorMode: { def: "primary" },
|
||||
cornerRadius: { def: 12, onChange: "updateCompositorLayout" },
|
||||
niriLayoutGapsOverride: { def: -1, onChange: "updateCompositorLayout" },
|
||||
niriLayoutRadiusOverride: { def: -1, onChange: "updateCompositorLayout" },
|
||||
|
||||
Reference in New Issue
Block a user