mirror of
https://github.com/danielepintore/dotfiles.git
synced 2026-07-05 05:25:16 +02:00
Add grayscale filter
This commit is contained in:
@@ -69,6 +69,8 @@ general {
|
||||
decoration {
|
||||
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
||||
|
||||
screen_shader = /home/daniele/.config/hypr/shaders/grayscale.frag
|
||||
|
||||
rounding = 5
|
||||
|
||||
blur {
|
||||
|
||||
33
.config/hypr/shaders/grayscale.frag
Normal file
33
.config/hypr/shaders/grayscale.frag
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Example blue light filter shader.
|
||||
//
|
||||
|
||||
//precision mediump float;
|
||||
//varying vec2 v_texcoord;
|
||||
//uniform sampler2D tex;
|
||||
//
|
||||
//void main() {
|
||||
//
|
||||
// vec4 pixColor = texture2D(tex, v_texcoord);
|
||||
//
|
||||
// pixColor[2] *= 0.;
|
||||
//
|
||||
// gl_FragColor = pixColor;
|
||||
//}
|
||||
// Example grayscale shader.
|
||||
|
||||
precision mediump float; // Set the precision for floating-point calculations.
|
||||
varying vec2 v_texcoord; // Varying texture coordinate passed from the vertex shader.
|
||||
uniform sampler2D tex; // The texture sampler.
|
||||
|
||||
void main() {
|
||||
// Sample the texture at the given coordinates.
|
||||
vec4 pixColor = texture2D(tex, v_texcoord);
|
||||
|
||||
// Compute the grayscale value using standard luminance weights.
|
||||
float gray = 0.299 * pixColor.r + 0.587 * pixColor.g + 0.114 * pixColor.b;
|
||||
|
||||
// Set the fragment color to the grayscale value, keeping the original alpha.
|
||||
gl_FragColor = vec4(vec3(gray), pixColor.a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user