I have written a lib for working with colours and stuck trying to calculate Tc(k). From what I have read working in the CIE 1931 XYZ colour space is the way to go and it can be obtained using xyY.
So far I have got everything correct to the point of figuring out the correct x and y from :
X Y
x = ____________ y = ____________
( X + Y + Z) ( X + Y + Z)
The numbers much up to the chart, but cant find anything that details how you go from x and y to Tc(K)

eg: For #FF0000 I get the following.
x: 0.64007449945677
y: 0.32997051063169
I have read a number of papers on the topic and litterally all the wikipedia articles. All the questions I have come across on SO simply link to a wiki article on colours, not seen one that has the actual formula for calculating Tc(k)

