29 lines
914 B
GLSL
29 lines
914 B
GLSL
// Grayscale.
|
|
//
|
|
// Panama's accessibility color filters. Selected by the `colorFilter`
|
|
// preference; hypr/looks.lua maps the enum to this path at config time and
|
|
// services/SystemSettings.qml does the same live.
|
|
//
|
|
// Hyprland runs one fragment shader over the finished frame, so this covers
|
|
// every window, the shell, video and the cursor alike.
|
|
//
|
|
// Rec. 709 luminance weights -- the same ones an SVG <feColorMatrix
|
|
// type="saturate" values="0"> uses. A flat average would make reds and blues
|
|
// far too bright and greens far too dark, because the eye does not weigh the
|
|
// channels equally.
|
|
|
|
#version 300 es
|
|
|
|
precision mediump float;
|
|
in vec2 v_texcoord;
|
|
layout(location = 0) out vec4 fragColor;
|
|
uniform sampler2D tex;
|
|
|
|
void main() {
|
|
vec4 pixColor = texture(tex, v_texcoord);
|
|
|
|
float luminance = dot(pixColor.rgb, vec3(0.2126, 0.7152, 0.0722));
|
|
|
|
fragColor = vec4(vec3(luminance), pixColor.a);
|
|
}
|