I have made a node group for cycles that output diffuse color so that you can use it in combination with a color ramp to get nice toon shading or other non photorealistic effects.
It works on a single light so you can select which lights you want to illuminate an object (the setup is a little wierd because there is no simple way of getting a single light position in blender, but I still find it manageable).
I have also converted it to OSL and through that I also got shadows working (not the best quality shadows but they work atleast).
I tried to get the shadows of transparent object working in OSL but i found the documentation lacking in that regard.
Also shadows from other lights are not working.
I currently have no use for this and I have never seen anybody else use a similar tecnique so I thought that releasing it here it could find a use somwhere (if somebody is using a similar tecnique please tell me, I’m interested in seeing how they implemented this).
Link to the file: https://drive.google.com/file/d/1rqtFFYkJI2xJL8FwM8qBETj8vZMK3ZNk/view?usp=sharing
The tv model in the file is not mine.
It is from the user vAonom (Dejan Petrovic) on Blend Swap.