Skip to content

Commit

Permalink
composer
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Dec 10, 2014
1 parent 8e6bc58 commit b28bfbd
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
22 changes: 22 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "mistic100/randomcolor",
"description": "Generate attractive random colors",
"version": "1.0.0",
"license": "MIT",
"authors": [{
"name": "Damien \"Mistic\" Sorel",
"email": "[email protected]",
"homepage": "http://www.strangeplanet.fr"
}],
"keywords": [
"color",
"random",
"generator"
],
"homepage": "https://github.com/mistic100/RandomColor.php",
"autoload": {
"psr-4": {
"Colors\\": "src"
}
}
}
11 changes: 6 additions & 5 deletions demo/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
include '../RandomColor.class.php';
include '../src/RandomColor.php';
use \Colors\RandomColor;
?>
<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -70,19 +71,19 @@
<?php $c = RandomColor::one(array('format'=>'hsv','luminosity'=>'dark')); ?>
<pre>
RandomColor::one(array('format'=>'hex'));
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// "' . RandomColor::format($c, 'hex') . '"</span>'; ?>
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// "' . RandomColor::hsv2hex($c) . '"</span>'; ?>


RandomColor::one(array('format'=>'hsv'));
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// ' . preg_replace("/[\\r\\n ]+/", '', var_export($c, true)) . '</span>'; ?>
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// ' . preg_replace('/\s+|,\s+(\))/', '$1', var_export($c, true)) . '</span>'; ?>


RandomColor::one(array('format'=>'hsl'));
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// ' . preg_replace("/[\\r\\n ]+/", '', var_export(RandomColor::format($c, 'hsl'), true)) . '</span>'; ?>
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// ' . preg_replace('/\s+|,\s+(\))/', '$1', var_export(RandomColor::hsv2hsl($c), true)) . '</span>'; ?>


RandomColor::one(array('format'=>'rgb'));
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// ' . preg_replace("/[\\r\\n ]+/", '', var_export(RandomColor::format($c, 'rgb'), true)) . '</span>'; ?>
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// ' . preg_replace('/\s+|,\s+(\))/', '$1', var_export(RandomColor::hsv2rgb($c), true)) . '</span>'; ?>


RandomColor::one(array('format'=>'hslCss'));
Expand Down
2 changes: 2 additions & 0 deletions RandomColor.class.php → src/RandomColor.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* SOFTWARE.
*/

namespace Colors;

class RandomColor
{
static private $dictionary = null;
Expand Down

0 comments on commit b28bfbd

Please sign in to comment.