ControlCenter: add proper shader for distro logo

This commit is contained in:
Ly-sec
2025-11-10 20:25:41 +01:00
parent 8c7a31931f
commit dfd3269928
3 changed files with 15 additions and 4 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ NIconButton {
layer.enabled: useDistroLogo && colorizeDistroLogo
layer.effect: ShaderEffect {
property color targetColor: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mSurfaceVariant
property real colorizeMode: 1.0
property real colorizeMode: 2.0
fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb")
}
+14 -3
View File
@@ -6,7 +6,7 @@ layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float qt_Opacity;
vec4 targetColor;
float colorizeMode; // 0.0 = dock mode (grayscale), 1.0 = tray mode (intensity)
float colorizeMode; // 0.0 = dock mode (grayscale), 1.0 = tray mode (intensity), 2.0 = distro mode (luminance with better contrast)
} ubuf;
void main() {
@@ -17,13 +17,24 @@ void main() {
if (ubuf.colorizeMode < 0.5) {
// Dock mode: Convert to grayscale using proper luminance weights
intensity = dot(tex.rgb, vec3(0.299, 0.587, 0.114));
} else {
} else if (ubuf.colorizeMode < 1.5) {
// Tray mode: Use the maximum RGB channel value as intensity
intensity = max(max(tex.r, tex.g), tex.b);
// Normalize intensity to make all icons more uniform
intensity = smoothstep(0.1, 0.9, intensity);
}
} else {
// Distro mode: Brightness boost with proper alpha handling
float maxChannel = max(max(tex.r, tex.g), tex.b);
intensity = maxChannel * 1.5;
intensity = min(intensity, 1.0);
intensity = intensity * 0.7 + 0.3;
intensity = intensity * tex.a;
fragColor = vec4(ubuf.targetColor.rgb * intensity, tex.a) * ubuf.qt_Opacity;
}
fragColor = vec4(ubuf.targetColor.rgb * intensity, tex.a) * ubuf.qt_Opacity;
}
Binary file not shown.