Skip to content

Commit 95d3379

Browse files
committed
init
0 parents  commit 95d3379

File tree

4 files changed

+632
-0
lines changed

4 files changed

+632
-0
lines changed

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Damien "Mistic" Sorel
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Random Color
2+
3+
For generating attractive random colors.
4+
5+
This is a PHP port of David Merfield [randomColor](https://github.com/davidmerfield/randomColor) Javascript utility.
6+
7+
See the results on [the demo](http://www.strangeplanet.fr/work/RandomColor.php).
8+
9+
[![Demo](http://llllll.li/randomColor/repo_demo.gif)](http://www.strangeplanet.fr/work/RandomColor.php)
10+
11+
### Options
12+
13+
You can pass an options object to influence the type of color it produces. The options object accepts the following properties:
14+
15+
**Hue** – Controls the hue of the generated color. You can pass a string representing a color name (e.g. 'orange'). Possible color names are *red, orange, yellow, green, blue, purple, pink and monochrome*.
16+
17+
**Luminosity** – Controls the luminosity of the generated color. You can pass a string containing *bright, light or dark*.
18+
19+
**Format** – A string which specifies the format of the generated color. Possible values are *hsv, hsl, hslCss, rgb, rgbCss, and hex*.
20+
21+
### Examples
22+
23+
```php
24+
25+
// Returns a hex code for an attractive color
26+
RandomColor::one();
27+
28+
// Returns an array of ten green colors
29+
RandomColor::many(10, array(
30+
'hue' => 'green'
31+
));
32+
33+
// Returns a hex code for a light blue
34+
RandomColor::one(array(
35+
'luminosity' => 'light',
36+
'hue' => 'blue'
37+
));
38+
39+
// Returns a hex code for a 'truly random' color
40+
RandomColor::one(array(
41+
'luminosity' => 'random',
42+
'hue' => 'random'
43+
));
44+
45+
// Returns a bright color in RGB
46+
RandomColor::one(array(
47+
'luminosity' => 'bright',
48+
'format' => 'rgbCss' // e.g. 'rgb(225,200,20)'
49+
));
50+
```
51+
52+
### Other languages
53+
54+
RandomColor is available in [JavaScript](https://github.com/davidmerfield/randomColor), [c#](https://github.com/nathanpjones/randomColorSharped) and [go](https://github.com/hansrodtang/randomcolor).
55+
56+
### License
57+
58+
This project is licensed under the terms of the MIT license.

0 commit comments

Comments
 (0)