diff options
| author | krolxon <krolyxon@tutanota.com> | 2026-01-11 19:18:06 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2026-01-11 19:18:06 +0530 |
| commit | ea8f17368def0b581efcc332d057c0a034d4da9b (patch) | |
| tree | 5fd0bfd6627d34b93090d79628bdd87793e9f715 /.config/hypr/shaders/11_invert.glsl | |
| parent | 4c31a041975718cc2fb933012a303cf457475ce7 (diff) | |
add shader script and keybinds
Diffstat (limited to '.config/hypr/shaders/11_invert.glsl')
| -rwxr-xr-x | .config/hypr/shaders/11_invert.glsl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/.config/hypr/shaders/11_invert.glsl b/.config/hypr/shaders/11_invert.glsl new file mode 100755 index 0000000..307b45d --- /dev/null +++ b/.config/hypr/shaders/11_invert.glsl @@ -0,0 +1,30 @@ +#version 300 es +// Invert Colors Shader - OPTIMIZED +// Added: Optional luminance-preserving mode + +precision highp float; + +in vec2 v_texcoord; +uniform sampler2D tex; +out vec4 fragColor; + +// Set true for "smart invert" that preserves relative brightness +const bool PRESERVE_LUMINANCE = false; +const vec3 LUMA = vec3(0.2126, 0.7152, 0.0722); + +void main() { + vec4 color = texture(tex, v_texcoord); + vec3 inverted = 1.0 - color.rgb; + + if (PRESERVE_LUMINANCE) { + // Adjust inverted colors to match original luminance + float origLuma = dot(color.rgb, LUMA); + float invLuma = dot(inverted, LUMA); + if (invLuma > 0.001) { + inverted *= origLuma / invLuma; + inverted = clamp(inverted, 0.0, 1.0); + } + } + + fragColor = vec4(inverted, color.a); +} |
