Skip to content

Commit b28bfbd

Browse files
committed
composer
1 parent 8e6bc58 commit b28bfbd

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ You can pass an options object to influence the type of color it produces. The o
2222

2323
```php
2424

25+
use \Colors\RandomColor;
26+
2527
// Returns a hex code for an attractive color
2628
RandomColor::one();
2729

composer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "mistic100/randomcolor",
3+
"description": "Generate attractive random colors",
4+
"version": "1.0.0",
5+
"license": "MIT",
6+
"authors": [{
7+
"name": "Damien \"Mistic\" Sorel",
8+
"email": "[email protected]",
9+
"homepage": "http://www.strangeplanet.fr"
10+
}],
11+
"keywords": [
12+
"color",
13+
"random",
14+
"generator"
15+
],
16+
"homepage": "https://github.com/mistic100/RandomColor.php",
17+
"autoload": {
18+
"psr-4": {
19+
"Colors\\": "src"
20+
}
21+
}
22+
}

demo/index.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
2-
include '../RandomColor.class.php';
2+
include '../src/RandomColor.php';
3+
use \Colors\RandomColor;
34
?>
45
<!DOCTYPE html>
56
<html lang="en">
@@ -70,19 +71,19 @@
7071
<?php $c = RandomColor::one(array('format'=>'hsv','luminosity'=>'dark')); ?>
7172
<pre>
7273
RandomColor::one(array('format'=>'hex'));
73-
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// "' . RandomColor::format($c, 'hex') . '"</span>'; ?>
74+
<?php echo '<span style="color:' . RandomColor::hsv2hex($c) . ';">// "' . RandomColor::hsv2hex($c) . '"</span>'; ?>
7475

7576

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

7980

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

8384

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

8788

8889
RandomColor::one(array('format'=>'hslCss'));
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
* SOFTWARE.
3030
*/
3131

32+
namespace Colors;
33+
3234
class RandomColor
3335
{
3436
static private $dictionary = null;

0 commit comments

Comments
 (0)