Need an education on shaders and help on how to adjust color values

Hello. I am trying to write a custom shader to make it such that there are no color gradients when the object is lit.
For example, any color above a certain value will remain unlit while any color below a certain value will be shaded solid black.

I experimented with the legacy diffuse shader and expected it to be something like this:

Shader “Legacy Shaders/CustomDiffuse” {
Properties {
_Color (“Main Color”, Color) = (1,1,1,1)
_MainTex (“Base (RGB)”, 2D) = “white” {}
}
SubShader {
Tags { “RenderType”=“Opaque” }
LOD 200

CGPROGRAM
#pragma surface surf Lambert

sampler2D _MainTex;
fixed4 _Color;

struct Input {
float2 uv_MainTex;
};

void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
if (c.r < 0.2 && c.b < 0.2 && c.g < 0.2)
{
c.r = 0.1;
c.g = 0.1;
c.b = 0.1;
}
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}

Fallback “Legacy Shaders/VertexLit”
}

I kind of understand why it didn’t work since I`m giving the rgb static values.
Can someone show me how to implement this or give me an understanding of how this shader is giving diffuse color?
It is to my understanding that the shader takes in the texture and multiplies it by _Color to give it the exact color of the texture to the object. In this case, since there are no other interactions, wouldn’t the object be unlit? Why is it taking in light information?

The surface function of Surface shaders are just defining the surface values of an object prior to the lighting model being applied to it. In simpler terms the surface shader is saying “this is a red ball” and later on in the shader it’s applying lighting to that red ball.

What you want is a custom lighting function.

I highly suggest you read this tutorial on Unity shaders.

Copy - Paste From above, the unlit shader

Shader "Unlit/SimpleUnlitTexturedShader"
{
    Properties
    {
        // we have removed support for texture tiling/offset,
        // so make them not be displayed in material inspector
        [NoScaleOffset] _MainTex ("Texture", 2D) = "white" {}
    }
    SubShader
    {
        Pass
        {
            CGPROGRAM
            // use "vert" function as the vertex shader
            #pragma vertex vert
            // use "frag" function as the pixel (fragment) shader
            #pragma fragment frag

            // vertex shader inputs
            struct appdata
            {
                float4 vertex : POSITION; // vertex position
                float2 uv : TEXCOORD0; // texture coordinate
            };

            // vertex shader outputs ("vertex to fragment")
            struct v2f
            {
                float2 uv : TEXCOORD0; // texture coordinate
                float4 vertex : SV_POSITION; // clip space position
            };

            // vertex shader
            v2f vert (appdata v)
            {
                v2f o;
                // transform position to clip space
                // (multiply with model*view*projection matrix)
                o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
                // just pass the texture coordinate
                o.uv = v.uv;
                return o;
            }
           
            // texture we will sample
            sampler2D _MainTex;

            // pixel shader; returns low precision ("fixed4" type)
            // color ("SV_Target" semantic)
            fixed4 frag (v2f i) : SV_Target
            {
                // sample texture and return it
                fixed4 col = tex2D(_MainTex, i.uv);
                return col;
            }
            ENDCG
        }
    }
}