diff --git a/Commons/Color.qml b/Commons/Color.qml index 19478e88a..6e940f520 100644 --- a/Commons/Color.qml +++ b/Commons/Color.qml @@ -324,23 +324,22 @@ Singleton { } } - // Smart alpha calculation: automatically makes light mode more transparent + // Adaptive opacity calculation: automatically makes light mode more transparent + function adaptiveOpacity(baseOpacity) { + return Settings.data.colorSchemes.darkMode ? baseOpacity : Math.pow(baseOpacity, 1.5); + } + function smartAlpha(baseColor, minAlpha = 0.4) { if (!Settings.data.ui.translucentWidgets) return baseColor; - let alpha = Math.max(root.panelBackgroundOpacity, minAlpha); + let alpha = Math.max(adaptiveOpacity(Settings.data.ui.panelBackgroundOpacity), minAlpha); // Combine with the base color's existing alpha let resultAlpha = Math.max(0, baseColor.a - (1.0 - alpha)); return Qt.alpha(baseColor, resultAlpha); } - readonly property real panelBackgroundOpacity: { - let baseOpacity = Settings.data.ui.panelBackgroundOpacity; - return Settings.data.colorSchemes.darkMode ? baseOpacity : Math.pow(baseOpacity, 2); - } - readonly property var colorKeyModel: [ { "key": "none", diff --git a/Modules/Dock/DockContent.qml b/Modules/Dock/DockContent.qml index 2609bdad0..09b495301 100644 --- a/Modules/Dock/DockContent.qml +++ b/Modules/Dock/DockContent.qml @@ -26,7 +26,7 @@ Item { // For vertical dock, swap width and height logic width: dockRoot.isVertical ? Math.round(dockRoot.iconSize * 1.5) : Math.min(dockLayout.implicitWidth + Style.marginXL, dockRoot.maxWidth) height: dockRoot.isVertical ? Math.min(dockLayout.implicitHeight + Style.marginXL, dockRoot.maxHeight) : Math.round(dockRoot.iconSize * 1.5) - color: Qt.alpha(Color.mSurface, (isAttachedMode ? 0 : Settings.data.dock.backgroundOpacity)) + color: Qt.alpha(Color.mSurface, (isAttachedMode ? 0 : Color.adaptiveOpacity(Settings.data.dock.backgroundOpacity))) // Anchor based on padding to achieve centering shift anchors.horizontalCenter: extraLeft > 0 || extraRight > 0 ? undefined : parent.horizontalCenter @@ -39,7 +39,7 @@ Item { radius: Style.radiusL border.width: Style.borderS - border.color: Qt.alpha(Color.mOutline, (isAttachedMode ? 0 : Settings.data.dock.backgroundOpacity)) + border.color: Qt.alpha(Color.mOutline, (isAttachedMode ? 0 : Color.adaptiveOpacity(Settings.data.dock.backgroundOpacity))) MouseArea { id: dockMouseArea diff --git a/Modules/MainScreen/Backgrounds/AllBackgrounds.qml b/Modules/MainScreen/Backgrounds/AllBackgrounds.qml index 9665b1860..4041bf8ae 100644 --- a/Modules/MainScreen/Backgrounds/AllBackgrounds.qml +++ b/Modules/MainScreen/Backgrounds/AllBackgrounds.qml @@ -38,7 +38,7 @@ Item { // Enable layer caching to prevent continuous re-rendering layer.enabled: true - opacity: Color.panelBackgroundOpacity + opacity: Color.adaptiveOpacity(Settings.data.ui.panelBackgroundOpacity) Shape { id: unifiedBackgroundsShape @@ -106,7 +106,7 @@ Item { anchors.fill: parent layer.enabled: true - opacity: Color.panelBackgroundOpacity + opacity: Color.adaptiveOpacity(Settings.data.ui.panelBackgroundOpacity) Shape { id: panelBackgroundsShape diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index 9d54102ea..a88d14b1b 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -549,9 +549,9 @@ Variants { id: cardBackground anchors.fill: parent radius: Style.radiusL - border.color: Qt.alpha(Color.mOutline, Settings.data.notifications.backgroundOpacity || 1.0) + border.color: Qt.alpha(Color.mOutline, Color.adaptiveOpacity(Settings.data.notifications.backgroundOpacity) || 1.0) border.width: Style.borderS - color: Qt.alpha(Color.mSurface, Settings.data.notifications.backgroundOpacity || 1.0) + color: Qt.alpha(Color.mSurface, Color.adaptiveOpacity(Settings.data.notifications.backgroundOpacity) || 1.0) // Progress bar Rectangle { @@ -570,7 +570,7 @@ Variants { color: { var baseColor = model.urgency === 2 ? Color.mError : model.urgency === 0 ? Color.mOnSurface : Color.mPrimary; - return Qt.alpha(baseColor, Settings.data.notifications.backgroundOpacity || 1.0); + return Qt.alpha(baseColor, Color.adaptiveOpacity(Settings.data.notifications.backgroundOpacity) || 1.0); } antialiasing: true diff --git a/Modules/OSD/OSD.qml b/Modules/OSD/OSD.qml index a743359be..a64eee612 100644 --- a/Modules/OSD/OSD.qml +++ b/Modules/OSD/OSD.qml @@ -575,8 +575,8 @@ Variants { anchors.fill: parent anchors.margins: Style.marginM * 1.5 radius: Style.radiusL - color: Qt.alpha(Color.mSurface, Settings.data.osd.backgroundOpacity || 1.0) - border.color: Qt.alpha(Color.mOutline, Settings.data.osd.backgroundOpacity || 1.0) + color: Qt.alpha(Color.mSurface, Color.adaptiveOpacity(Settings.data.osd.backgroundOpacity) || 1.0) + border.color: Qt.alpha(Color.mOutline, Color.adaptiveOpacity(Settings.data.osd.backgroundOpacity) || 1.0) border.width: { const bw = Math.max(2, Style.borderM); return bw % 2 === 0 ? bw : bw + 1; diff --git a/Modules/Panels/Launcher/LauncherOverlayWindow.qml b/Modules/Panels/Launcher/LauncherOverlayWindow.qml index 3b1b2c80c..47699069e 100644 --- a/Modules/Panels/Launcher/LauncherOverlayWindow.qml +++ b/Modules/Panels/Launcher/LauncherOverlayWindow.qml @@ -255,7 +255,7 @@ Variants { ShapePath { strokeWidth: -1 - fillColor: Qt.alpha(Color.mSurface, Color.panelBackgroundOpacity) + fillColor: Qt.alpha(Color.mSurface, Color.adaptiveOpacity(Settings.data.ui.panelBackgroundOpacity)) // Offset by radius to account for Shape's extended bounds startX: panelShape.radius + panelShape.radius * panelShape.tlMultX diff --git a/Modules/Panels/Settings/Tabs/Dock/AppearanceSubTab.qml b/Modules/Panels/Settings/Tabs/Dock/AppearanceSubTab.qml index 1314e5a3d..01887a079 100644 --- a/Modules/Panels/Settings/Tabs/Dock/AppearanceSubTab.qml +++ b/Modules/Panels/Settings/Tabs/Dock/AppearanceSubTab.qml @@ -392,7 +392,6 @@ ColumnLayout { color: Color.smartAlpha(Color.mSurfaceVariant) border.color: Color.mOutline border.width: Style.borderS - opacity: Style.opacityMedium Image { anchors.centerIn: parent diff --git a/Modules/Panels/Settings/Tabs/Wallpaper/GeneralSubTab.qml b/Modules/Panels/Settings/Tabs/Wallpaper/GeneralSubTab.qml index 60fcec84d..712d71c99 100644 --- a/Modules/Panels/Settings/Tabs/Wallpaper/GeneralSubTab.qml +++ b/Modules/Panels/Settings/Tabs/Wallpaper/GeneralSubTab.qml @@ -182,6 +182,7 @@ ColumnLayout { label: I18n.tr("panels.wallpaper.settings-use-original-images-label") description: I18n.tr("panels.wallpaper.settings-use-original-images-description") checked: Settings.data.wallpaper.useOriginalImages + enabled: Settings.data.wallpaper.enabled onToggled: checked => Settings.data.wallpaper.useOriginalImages = checked defaultValue: Settings.getDefaultValue("wallpaper.useOriginalImages") } @@ -189,6 +190,7 @@ ColumnLayout { RowLayout { spacing: Style.marginM Layout.fillWidth: true + enabled: Settings.data.wallpaper.enabled NLabel { label: I18n.tr("panels.wallpaper.settings-clear-cache-label") @@ -228,10 +230,9 @@ ColumnLayout { NValueSlider { Layout.fillWidth: true - enabled: Settings.data.wallpaper.overviewEnabled + visible: Settings.data.wallpaper.overviewEnabled label: I18n.tr("panels.wallpaper.settings-overview-blur-strength-label") description: I18n.tr("panels.wallpaper.settings-overview-blur-strength-description") - visible: CompositorService.isNiri from: 0.0 to: 1.0 stepSize: 0.01 @@ -244,10 +245,9 @@ ColumnLayout { NValueSlider { Layout.fillWidth: true - enabled: Settings.data.wallpaper.overviewEnabled + visible: Settings.data.wallpaper.overviewEnabled label: I18n.tr("panels.wallpaper.settings-overview-tint-label") description: I18n.tr("panels.wallpaper.settings-overview-tint-description") - visible: CompositorService.isNiri from: 0.0 to: 1.0 stepSize: 0.01 diff --git a/Modules/Toast/Toast.qml b/Modules/Toast/Toast.qml index eda85fc5e..a3cf7dfc4 100644 --- a/Modules/Toast/Toast.qml +++ b/Modules/Toast/Toast.qml @@ -96,7 +96,7 @@ Item { anchors.fill: parent anchors.margins: shadowPadding radius: Style.radiusL - color: Qt.alpha(Color.mSurface, Settings.data.notifications.backgroundOpacity || 1.0) + color: Qt.alpha(Color.mSurface, Color.adaptiveOpacity(Settings.data.notifications.backgroundOpacity) || 1.0) // Colored border based on type border.width: Style.borderS @@ -110,7 +110,7 @@ Item { baseColor = Color.mOutline; break; } - return Qt.alpha(baseColor, Settings.data.notifications.backgroundOpacity || 1.0); + return Qt.alpha(baseColor, Color.adaptiveOpacity(Settings.data.notifications.backgroundOpacity) || 1.0); } // Progress bar @@ -142,7 +142,7 @@ Item { baseColor = Color.mPrimary; // Match standard notification color break; } - return Qt.alpha(baseColor, Settings.data.notifications.backgroundOpacity || 1.0); + return Qt.alpha(baseColor, Color.adaptiveOpacity(Settings.data.notifications.backgroundOpacity) || 1.0); } } }