mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-22 02:55:21 -04:00
feat(dbar): add workspace & widget color customization options
This commit is contained in:
@@ -450,7 +450,9 @@ Singleton {
|
||||
"primaryText": getMatugenColor("on_primary", "#ffffff"),
|
||||
"primaryContainer": getMatugenColor("primary_container", "#1976d2"),
|
||||
"secondary": getMatugenColor("secondary", "#8ab4f8"),
|
||||
"secondaryContainer": getMatugenColor("secondary_container", getMatugenColor("surface_container_high", "#292b2f")),
|
||||
"tertiary": getMatugenColor("tertiary", "#efb8c8"),
|
||||
"tertiaryContainer": getMatugenColor("tertiary_container", getMatugenColor("surface_container_high", "#292b2f")),
|
||||
"surface": getMatugenColor("surface", "#1a1c1e"),
|
||||
"surfaceText": getMatugenColor("on_background", "#e3e8ef"),
|
||||
"surfaceVariant": getMatugenColor("surface_variant", "#44464f"),
|
||||
@@ -521,7 +523,6 @@ Singleton {
|
||||
|
||||
property color primary: currentThemeData.primary
|
||||
property color primaryText: currentThemeData.primaryText
|
||||
property color primaryContainer: currentThemeData.primaryContainer
|
||||
property color secondary: currentThemeData.secondary
|
||||
property color tertiary: currentThemeData.tertiary || currentThemeData.secondary
|
||||
property color surface: currentThemeData.surface
|
||||
@@ -536,6 +537,9 @@ Singleton {
|
||||
property color surfaceContainer: currentThemeData.surfaceContainer
|
||||
property color surfaceContainerHigh: currentThemeData.surfaceContainerHigh
|
||||
property color surfaceContainerHighest: currentThemeData.surfaceContainerHighest || surfaceContainerHigh
|
||||
property color primaryContainer: currentThemeData.primaryContainer || blend(surfaceContainerHigh, primary, 0.45)
|
||||
property color secondaryContainer: currentThemeData.secondaryContainer || blend(surfaceContainerHigh, secondary, 0.35)
|
||||
property color tertiaryContainer: currentThemeData.tertiaryContainer || blend(surfaceContainerHigh, tertiary, 0.35)
|
||||
|
||||
property color onSurface: surfaceText
|
||||
property color onSurfaceVariant: surfaceVariantText
|
||||
@@ -1430,9 +1434,22 @@ Singleton {
|
||||
|
||||
property bool widgetBackgroundHasAlpha: {
|
||||
const colorMode = typeof SettingsData !== "undefined" ? SettingsData.widgetBackgroundColor : "sch";
|
||||
return colorMode === "sth";
|
||||
return colorMode === "sth" || colorMode === "custom";
|
||||
}
|
||||
|
||||
function safeColor(value, fallback) {
|
||||
try {
|
||||
if (value === undefined || value === null || value === "")
|
||||
return fallback;
|
||||
return Qt.color(value);
|
||||
} catch (e) {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
readonly property color widgetBackgroundCustomBaseColor: safeColor(typeof SettingsData !== "undefined" ? SettingsData.widgetBackgroundCustomColor : "#6750A4", primaryContainer)
|
||||
readonly property real widgetBackgroundCustomStrength: Math.max(0, Math.min(1, typeof SettingsData !== "undefined" ? (SettingsData.widgetBackgroundCustomStrength ?? 0.4) : 0.4))
|
||||
|
||||
property var widgetBaseBackgroundColor: {
|
||||
const colorMode = typeof SettingsData !== "undefined" ? SettingsData.widgetBackgroundColor : "sch";
|
||||
switch (colorMode) {
|
||||
@@ -1442,6 +1459,14 @@ Singleton {
|
||||
return surfaceContainer;
|
||||
case "sch":
|
||||
return surfaceContainerHigh;
|
||||
case "primaryContainer":
|
||||
return primaryContainer;
|
||||
case "secondaryContainer":
|
||||
return secondaryContainer;
|
||||
case "tertiaryContainer":
|
||||
return tertiaryContainer;
|
||||
case "custom":
|
||||
return blend(surfaceContainerHigh, widgetBackgroundCustomBaseColor, widgetBackgroundCustomStrength);
|
||||
case "sth":
|
||||
default:
|
||||
return surfaceTextHover;
|
||||
|
||||
Reference in New Issue
Block a user