how convert RGB or CMYK color to percentage CMYK - javascript
问题 I use this snippet to convert RGB color to CMYK in javascript: function RgbToCmyk(R,G,B) { if ((R == 0) && (G == 0) && (B == 0)) { return [0, 0, 0, 1]; } else { var calcR = 1 - (R / 255), calcG = 1 - (G / 255), calcB = 1 - (B / 255); var K = Math.min(calcR, Math.min(calcG, calcB)), C = (calcR - K) / (1 - K), M = (calcG - K) / (1 - K), Y = (calcB - K) / (1 - K); return [C, M, Y, K]; } } now I want to convert returned CMYK to percentage CMYK. for example this RGB color (171,215,170) become