# Topic: Colour wheels

mahjqa

From: The Demented Side of the Fence
Insane since: Aug 2000

posted 10-09-2011 16:45

'lo everyone. I started myself a new education (Communication & multimedia design) and one of the first assignments I got was to build a color wheel, and use it to illustrate what primary, secondary and tertiary colors are. The example given used the standard primary colors: Red, yellow and blue. (As seen on the right)

I went a different way, and started with Cyan, Magenta and Yellow as primary colors, since that makes a bit more sense when you're dealing with printing and so on.

So, is either one of them better? How would I find the right CMYK values for the colour wheel on the right?

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted 10-11-2011 09:49

Good for you .

I like yours much better - it's a bit less prone to crosstalk between the colors.
Might wish to use a greyish background though?

And I have no clue if there's an easy way to read cymk from the right one...

so long,

->Tyberius Prime

Arthurio
Paranoid (IV) Inmate

From: cell 3736
Insane since: Jul 2003

posted 10-17-2011 09:12
code:
```function rgb2cmyk (r,g,b) {
var computedC = 0;
var computedM = 0;
var computedY = 0;
var computedK = 0;

//remove spaces from input RGB values, convert to int
var r = parseInt( (''+r).replace(/\s/g,''),10 );
var g = parseInt( (''+g).replace(/\s/g,''),10 );
var b = parseInt( (''+b).replace(/\s/g,''),10 );

if ( r==null || g==null || b==null ||
isNaN(r) || isNaN(g)|| isNaN(b) )
{
return;
}
if (r<0 || g<0 || b<0 || r>255 || g>255 || b>255) {
alert ('RGB values must be in the range 0 to 255.');
return;
}

// BLACK
if (r==0 && g==0 && b==0) {
computedK = 1;
return [0,0,0,1];
}

computedC = 1 - (r/255);
computedM = 1 - (g/255);
computedY = 1 - (b/255);

var minCMY = Math.min(computedC,
Math.min(computedM,computedY));
computedC = (computedC - minCMY) / (1 - minCMY) ;
computedM = (computedM - minCMY) / (1 - minCMY) ;
computedY = (computedY - minCMY) / (1 - minCMY) ;
computedK = minCMY;

return [computedC,computedM,computedY,computedK];
}```