Get light colour in material

Thanks IMX, setting up a faux rim shader was the next step I was after so I can definitely make use of your advice, but what I’m after is the ability to map colour to luminance using an arbitrary gradient. The process would be something like:

> Get total light colour
> Convert to luminance (0.3 * R + 0.59 * G + 0.11 * B)
> Clamp to 0 to 1 range
> Sample gradient texture where U = 0, V = luminance
> Return total light colour * sampled gradient texture