Turning Rim Light Shader into a Rim Line Shader

I'd like to create a toon-like look for my project and figured I could modify the rim light shader found on the wiki so it darkened the rims instead of lighting them.

However, since I haven't worked with ShaderLab yet, I seem to be unable to make the necessary changes to the shader. Maybe someone could hive me some hints how to change the mode the rim light is factored in?

I guess the change should occur around here:

half4 frag (v2f i) : COLOR
           half3 tangentSpaceNormal = (tex2D(_BumpMap, i.uv).rgb * 2.0) - 1.0;

           half4 result = float4(0, 0, 0, 1);

           //You might want to normalize tangentSpaceNormal and i.tangentSpaceLightDir,
           //but for most meshes this will most likely have minimal, if any, impact on quality.
           float rampSample = dot(tangentSpaceNormal, i.tangentSpaceLightDir);
           float intensity = tex2D(_RimLightRamp, rampSample.xx).r;

           result.rgb = intensity * _RimLightColor.rgb;
           result.rgb += tex2D(_MainTex, i.uv).rgb * _PPLAmbient.rgb;

           return result;

Just where? And how?

While I'm not familiar with that particular shader, it appears that the lighting contribution for the rim lighting is factored into the output color in the line:

result.rgb = intensity * _RimLightColor.rgb;

The following line:

result.rgb += tex2D(_MainTex, i.uv).rgb * _PPLAmbient.rgb;

is the texture color + a constant ambient contribution

Consider modifying the two lines to be something more like this:

result.rgb = tex2D(_MainTex, i.uv).rgb * _PPLAmbient.rgb;
result.rgb -= intensity * _RimLightColor.rgb;

I'm not sure if CG will complain if any component of result.rgb is < 0, but you could include a check for that before returning result at the end

For more information on CG shaders, use NVIDIA's official reference and tutorial book (free online): http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter01.html