I made a library

From: Mikee10 Oct 2010 14:38
To: ALL1 of 7

What's this? a finished project from Mikee? Surely not.

 

I made a little library for messing with colors.

 

http://code.google.com/p/colorjizz/

 

(Badly) ported to 4 languages at the moment.

 

Struggling with my unit tests though. There will always be slight conversion differences, so I'm not sure if I should leave my unit tests to fail or specific a range of error to let them pass. But who decides the range of error? :/

 

For example, if I convert to one format then back again, it might be 0.0004 out when it converts back. Obviously makes no difference in reality, but hmm.

From: Mikee 8 Oct 2012 13:34
To: ALL2 of 7

http://mikeefranklin.co.uk:8080/job/ColorJizz-PHP/

 

Upgraded, using PHP namespaces now using PSR-2. Added to Jenkins with unit testing and code coverage, also moved it over to Github and added it to packagist.

From: ANT_THOMAS 8 Oct 2012 13:36
To: Mikee 3 of 7
What does it do?
From: Mikee 8 Oct 2012 13:44
To: ANT_THOMAS 4 of 7
It's for playing with colours.

You can convert colours from one format to any of the other formats, for example:


php code:
<?php
echo Hex::create(0xCC0000)->toCMYK();
echo Hex::create(0xCC0000)->toCIELab();
echo Hex::create(0xCC0000)->toCIELCh();
echo Hex::create(0xCC0000)->toRGB();
echo Hex::fromString('black')->toHSV();
echo RGB::create(200,100,150)->toHex();
?>


Or find colour harmonies, modify colours or match colours:

php code:
<?php
echo Hex::fromString('#cc0000')->greyscale();

echo Hex::fromString('#cc0000')->websafe();

echo Hex::fromString('#cc0000')->match(array(
  new RGB(0,0,0),
  new XYZ(1,1,1),
  new Hex(0x00FF00)
));

echo Hex::create(0xFF0000)->range(Hex::create(0x0000FF), 100);

echo new RGB(100,0,100)->split(2);

echo new RGB(100,0,100)->hue(-2);
?>


I should document it properly at some point with examples.

(no syntax highlighting? :()
EDITED: 8 Oct 2012 13:47 by MIKEE
From: Mikee 8 Oct 2012 13:46
To: Mikee 5 of 7
Edit: oh, I kinda have a bit. https://github.com/mikeemoo/ColorJizz-PHP/
From: CHYRON (DSMITHHFX) 8 Oct 2012 13:54
To: Mikee 6 of 7
From: Mikee 8 Oct 2012 14:01
To: CHYRON (DSMITHHFX) 7 of 7
Uhrmm... :/