Skip to content

Commit 939f4ec

Browse files
todo: make this usage guide better.
fixes #1
1 parent a2230b9 commit 939f4ec

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,51 @@ Not requred, but you can addd the Csscolor alias if you want.
3131

3232
'Csscolor' => 'SoapBox\Csscolor\Facade'
3333
)
34+
```
35+
36+
37+
## How to Use:
38+
39+
All you need to do is put the HEX values into a colour object
40+
```php
41+
$color = Csscolor::make('3D88C8');
42+
43+
$color->bg['0']; // returns the same colour as entered
44+
$color->bg['+1']; // +1 to +5 and -1 to -5 to return variations of the colour to work with gradiants
45+
$color->fg['0']; // returns a colour that can sit on the foreground of the defined hex value
46+
...
47+
48+
```
49+
50+
A var_dump of the $color objects instanciated with the color #3D88C8 look like the following:
51+
```php
52+
object(SoapBox\Csscolor\Csscolor)[1109]
53+
public 'bg' =>
54+
array (size=11)
55+
0 => string '3D88C8' (length=6)
56+
'+1' => string '5a9ad0' (length=6)
57+
'+2' => string '6ea6d6' (length=6)
58+
'+3' => string '9fc4e4' (length=6)
59+
'+4' => string 'cee1f1' (length=6)
60+
'+5' => string 'ecf4fa' (length=6)
61+
-1 => string '3474aa' (length=6)
62+
-2 => string '2e6696' (length=6)
63+
-3 => string '1f4464' (length=6)
64+
-4 => string '0f2232' (length=6)
65+
-5 => string '060e14' (length=6)
66+
public 'fg' =>
67+
array (size=11)
68+
0 => string 'ffffff' (length=6)
69+
'+1' => string '000000' (length=6)
70+
'+2' => string '000000' (length=6)
71+
'+3' => string '000000' (length=6)
72+
'+4' => string '0f2232' (length=6)
73+
'+5' => string '1f4464' (length=6)
74+
-1 => string 'ffffff' (length=6)
75+
-2 => string 'ffffff' (length=6)
76+
-3 => string 'ffffff' (length=6)
77+
-4 => string 'cee1f1' (length=6)
78+
-5 => string '9fc4e4' (length=6)
79+
public 'minBrightDiff' => int 126
80+
public 'minColorDiff' => int 500
3481
```

0 commit comments

Comments
 (0)