Given:
A point P, circle 1 and circle 2’s positions and radii
What is:
The equation for T, the ‘mix level’ between color 1 and 2 (a value between 0 to 1)
Many radial gradient equations only apply to concentric circles or circles that share a position. I’m looking for something that matches the image below, created using Quartz (Core Graphics). I am writing a GLSL shader, but I need to understand the math first.

If this is in 2D, then you can write the parameters of the circle that your point lies on as:
EDIT: Of course, that circle can be represented as:
You can substitute the first 3 equations into the last (and remember that (xP, yP) is your point) to get 1 equation with only T as a variable that is quadratic in T, so it is easy to solve for T. Doing so gives us:
I know that that is a bit hard to read, but it is not actually that bad mathematically. It is just addition, multiplication, and squaring (which is really just multiplication).