1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-12 16:52:10 -04:00

Moar M3 iteration stuffs

This commit is contained in:
purian23
2026-02-26 23:02:49 -05:00
parent 972bc8397d
commit 3c5d8ba66a
23 changed files with 514 additions and 329 deletions

View File

@@ -167,6 +167,14 @@ Singleton {
onEnableRippleEffectsChanged: saveSettings()
property bool m3ElevationEnabled: true
onM3ElevationEnabledChanged: saveSettings()
property int m3ElevationIntensity: 12
onM3ElevationIntensityChanged: saveSettings()
property int m3ElevationOpacity: 30
onM3ElevationOpacityChanged: saveSettings()
property string m3ElevationColorMode: "default"
onM3ElevationColorModeChanged: saveSettings()
property string m3ElevationCustomColor: "#000000"
onM3ElevationCustomColorChanged: saveSettings()
property bool modalElevationEnabled: true
onModalElevationEnabledChanged: saveSettings()
property bool popoutElevationEnabled: true
@@ -608,7 +616,7 @@ Singleton {
"scrollYBehavior": "workspace",
"shadowIntensity": 0,
"shadowOpacity": 60,
"shadowColorMode": "text",
"shadowColorMode": "default",
"shadowCustomColor": "#000000",
"clickThrough": false
}

View File

@@ -674,40 +674,74 @@ Singleton {
property color shadowStrong: Qt.rgba(0, 0, 0, 0.3)
readonly property bool elevationEnabled: typeof SettingsData !== "undefined" && (SettingsData.m3ElevationEnabled ?? true)
readonly property real elevationBlurMax: 16
readonly property real elevationBlurMax: typeof SettingsData !== "undefined" && SettingsData.m3ElevationIntensity !== undefined ? Math.min(128, Math.max(32, SettingsData.m3ElevationIntensity * 2)) : 64
readonly property real _elevMult: typeof SettingsData !== "undefined" && SettingsData.m3ElevationIntensity !== undefined ? SettingsData.m3ElevationIntensity / 12 : 1
readonly property real _opMult: typeof SettingsData !== "undefined" && SettingsData.m3ElevationOpacity !== undefined ? SettingsData.m3ElevationOpacity / 60 : 1
readonly property var elevationLevel1: ({
blurPx: 4,
offsetY: 1,
blurPx: 4 * _elevMult,
offsetY: 1 * _elevMult,
spreadPx: 0,
alpha: 0.2
alpha: 0.2 * _opMult
})
readonly property var elevationLevel2: ({
blurPx: 8,
offsetY: 4,
blurPx: 8 * _elevMult,
offsetY: 4 * _elevMult,
spreadPx: 0,
alpha: 0.25
alpha: 0.25 * _opMult
})
readonly property var elevationLevel3: ({
blurPx: 12,
offsetY: 6,
blurPx: 12 * _elevMult,
offsetY: 6 * _elevMult,
spreadPx: 0,
alpha: 0.3
alpha: 0.3 * _opMult
})
readonly property var elevationLevel4: ({
blurPx: 16,
offsetY: 8,
blurPx: 16 * _elevMult,
offsetY: 8 * _elevMult,
spreadPx: 0,
alpha: 0.3
alpha: 0.3 * _opMult
})
readonly property var elevationLevel5: ({
blurPx: 20,
offsetY: 10,
blurPx: 20 * _elevMult,
offsetY: 10 * _elevMult,
spreadPx: 0,
alpha: 0.3
alpha: 0.3 * _opMult
})
function elevationShadowColor(level) {
const alpha = (level && level.alpha !== undefined) ? level.alpha : 0.3;
return Qt.rgba(0, 0, 0, alpha);
let r = 0;
let g = 0;
let b = 0;
if (typeof SettingsData !== "undefined") {
const mode = SettingsData.m3ElevationColorMode || "default";
if (mode === "default") {
r = 0;
g = 0;
b = 0;
} else if (mode === "text") {
r = surfaceText.r;
g = surfaceText.g;
b = surfaceText.b;
} else if (mode === "primary") {
r = primary.r;
g = primary.g;
b = primary.b;
} else if (mode === "surfaceVariant") {
r = surfaceVariant.r;
g = surfaceVariant.g;
b = surfaceVariant.b;
} else if (mode === "custom" && SettingsData.m3ElevationCustomColor) {
const c = Qt.color(SettingsData.m3ElevationCustomColor);
r = c.r;
g = c.g;
b = c.b;
}
}
return Qt.rgba(r, g, b, alpha);
}
function elevationTintOpacity(level) {
if (!level)

View File

@@ -47,6 +47,10 @@ var SPEC = {
modalCustomAnimationDuration: { def: 150 },
enableRippleEffects: { def: true },
m3ElevationEnabled: { def: true },
m3ElevationIntensity: { def: 12 },
m3ElevationOpacity: { def: 30 },
m3ElevationColorMode: { def: "default" },
m3ElevationCustomColor: { def: "#000000" },
modalElevationEnabled: { def: true },
popoutElevationEnabled: { def: true },
wallpaperFillMode: { def: "Fill" },
@@ -428,7 +432,7 @@ var SPEC = {
scrollYBehavior: "workspace",
shadowIntensity: 0,
shadowOpacity: 60,
shadowColorMode: "text",
shadowColorMode: "default",
shadowCustomColor: "#000000",
clickThrough: false
}], onChange: "updateBarConfigs"