how do I get light Shadows and texture 'dim' at same time in a shader?

I just started today with learning how Shaders works… there is 1 thing I cannot figure out so far…

in my game, I update the mesh on a gameobject in runtime, I also dimm the colors on the mesh in runtime…

now I will try to make a directional light cast shadows on the same texture that is (dimmed already in runtime with mesh.colors32)…

My current shader (Im trying to merge 2 shaders that each already do the thing I need…):

Shader "TestShader" {
	Properties {
		_Color ("Main Color", Color) = (1,1,1,0.5)
		_MainTex ("Base (RGB)", 2D) = "grass" {}
		//_LightPower ("Light Power", Float) = 0.0

	SubShader {

	Tags { "RenderType"="Opaque" }
        LOD 200

		Pass {

		Lighting On

		Tags {"LightMode" = "ForwardBase"}


			#pragma multi_compile_fwdbase
			#pragma vertex vert
			#pragma fragment frag
			#pragma fragmentoption ARB_fog_exp2

			#include "UnityCG.cginc"
			#include "AutoLight.cginc"
			#include "Lighting.cginc"

			float4 _Color;
			sampler2D _MainTex;
			float _LightPower;
			struct v2f
				float4 pos : SV_POSITION;
				float2 uv : TEXCOORD0;
			//    float2 uv : TEXCOORD1;   
				float3 color : COLOR0;
				float4 lighting : TEXCOORD1;

			struct indata
				float4 vertex;
				float3 normal;
				float4 texcoord;
				float4 color;


			v2f vert(indata v)
				v2f o;
				o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
			//	o.uv = TRANSFORM_UV(0);
				o.uv = v.texcoord.xy;
				o.color = v.color; //_Color; //v.normal * 0.5 + 0.5;
				return o;

			float4 frag(v2f i) : COLOR

				float3 lightColor = _LightColor0.rgb;
			    float3 lightDir = _WorldSpaceLightPos0;
			    float4 colorTex = tex2D(_MainTex, i.uv.xy);
				float  atten = LIGHT_ATTENUATION(i);
				float3 N = float3(0.0f, 1.0f, 0.0f);
				float  NL = saturate(dot(N, lightDir));

				return float4((i.color*tex2D(_MainTex, i.uv).rgb)*atten, colorTex.a);//*;  
				float3 color = colorTex.rgb * lightColor * NL * atten;
      			return float4(color, colorTex.a);


Finally after much much searching and learning, I found a ‘simple’ shader that did the trick…

post no. 8 in this thread:

from: VslPaul