color splash (show only one color)

the shader makes the color splash effect
where it shows only one color in an image 
and the rest is gray (black and white values)

add the shader to ColorRect node
then from the shader prem chose the color you want
and then make the ColorRect node in the top layer
like that the effect will work in anything on the screen

in the shader prem, there are 3 prems
hide = so you can hide the effect to show anything under it
color = to chose the color you want to show only
strength = where you chose the color range to show

Shader code
shader_type canvas_item;

uniform bool hide = false;
uniform vec4 color : hint_color = vec4(1);
uniform float strength = 0.2;

void fragment(){
	vec4 pixel = texture(SCREEN_TEXTURE, SCREEN_UV);
        COLOR = pixel;
	if (hide == false){ 
		vec3 grayscale_value = vec3(dot(pixel.rgb, vec3(0.299, 0.587, 0.114)));
		float range = 1.0 - step(distance(pixel.rgb, color.rgb), strength);
		COLOR.rgb = mix(pixel.rgb, grayscale_value, range);
color splash, gray scale, gray value, one color
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from Owl

white balance shader

Related shaders

Gradient Color Correction for ViewportTextures

Invert color

Color manipulator

Inline Feedbacks
View all comments