diff --git a/README.md b/README.md index 267b6b4..6c642fd 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ You can pass an options object to influence the type of color it produces. The o ```php +use \Colors\RandomColor; + // Returns a hex code for an attractive color RandomColor::one(); diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..60aab10 --- /dev/null +++ b/composer.json @@ -0,0 +1,22 @@ +{ + "name": "mistic100/randomcolor", + "description": "Generate attractive random colors", + "version": "1.0.0", + "license": "MIT", + "authors": [{ + "name": "Damien \"Mistic\" Sorel", + "email": "contact@git.strangeplanet.fr", + "homepage": "http://www.strangeplanet.fr" + }], + "keywords": [ + "color", + "random", + "generator" + ], + "homepage": "https://github.com/mistic100/RandomColor.php", + "autoload": { + "psr-4": { + "Colors\\": "src" + } + } +} diff --git a/demo/index.php b/demo/index.php index 3aac575..de6e3a3 100644 --- a/demo/index.php +++ b/demo/index.php @@ -1,5 +1,6 @@ @@ -70,19 +71,19 @@ 'hsv','luminosity'=>'dark')); ?>
RandomColor::one(array('format'=>'hex')); - // "' . RandomColor::format($c, 'hex') . '"'; ?> + // "' . RandomColor::hsv2hex($c) . '"'; ?> RandomColor::one(array('format'=>'hsv')); - // ' . preg_replace("/[\\r\\n ]+/", '', var_export($c, true)) . ''; ?> + // ' . preg_replace('/\s+|,\s+(\))/', '$1', var_export($c, true)) . ''; ?> RandomColor::one(array('format'=>'hsl')); - // ' . preg_replace("/[\\r\\n ]+/", '', var_export(RandomColor::format($c, 'hsl'), true)) . ''; ?> + // ' . preg_replace('/\s+|,\s+(\))/', '$1', var_export(RandomColor::hsv2hsl($c), true)) . ''; ?> RandomColor::one(array('format'=>'rgb')); - // ' . preg_replace("/[\\r\\n ]+/", '', var_export(RandomColor::format($c, 'rgb'), true)) . ''; ?> + // ' . preg_replace('/\s+|,\s+(\))/', '$1', var_export(RandomColor::hsv2rgb($c), true)) . ''; ?> RandomColor::one(array('format'=>'hslCss')); diff --git a/RandomColor.class.php b/src/RandomColor.php similarity index 99% rename from RandomColor.class.php rename to src/RandomColor.php index 368c042..900a68f 100644 --- a/RandomColor.class.php +++ b/src/RandomColor.php @@ -29,6 +29,8 @@ * SOFTWARE. */ +namespace Colors; + class RandomColor { static private $dictionary = null;