@@ -29,28 +29,87 @@ composer require binafy/php-color-generator
29
29
30
30
#### ` hexToRGB(string $hex): array `
31
31
32
- If you may convert hex to RGB, you need to use ` hexToRGB ` method:
32
+ If you may convert hex to RGB, you need to use ` hexToRGB() ` method:
33
33
34
34
``` php
35
- use Binafy\PhpColorGenerator\ColorService ;
35
+ use Binafy\PhpColorGenerator\Color ;
36
36
37
- ColorService ::hexToRGB('1363df');
37
+ Color ::hexToRGB('1363df');
38
38
```
39
39
40
40
#### ` rgbToHex(string $hex): string `
41
41
42
- If you may convert RGB to hex, you need to use ` rgbToHex ` method:
42
+ If you may convert RGB to hex, you need to use ` rgbToHex() ` method:
43
43
44
44
``` php
45
- use Binafy\PhpColorGenerator\ColorService ;
45
+ use Binafy\PhpColorGenerator\Color ;
46
46
47
- ColorService ::rgbToHex([
47
+ Color ::rgbToHex([
48
48
'red' => '19',
49
49
'green' => '99',
50
50
'blue' => '223',
51
51
]);
52
52
```
53
53
54
+ #### ` darken(array $rgb, float $percentage): array `
55
+
56
+ If you may get darken rgb color, you can use ` darken() ` method:
57
+
58
+ ``` php
59
+ use Binafy\PhpColorGenerator\Color;
60
+
61
+ Color::darken([
62
+ 'red' => '19',
63
+ 'green' => '99',
64
+ 'blue' => '223',
65
+ ], 0.5); // array ('red', 'blue', 'green')
66
+ ```
67
+
68
+
69
+ #### ` lighten(array $rgb, float $percentage): array `
70
+
71
+ If you may get lighten rgb color, you can use ` lighten() ` method:
72
+
73
+ ``` php
74
+ use Binafy\PhpColorGenerator\Color;
75
+
76
+ Color::lighten([
77
+ 'red' => '19',
78
+ 'green' => '99',
79
+ 'blue' => '223',
80
+ ], 0.5); // array ('red', 'blue', 'green')
81
+ ```
82
+
83
+ #### ` generateShades(string $hex, int $times): array `
84
+
85
+ If you want to generate shades from hex color, you can use ` generateShades() ` method:
86
+
87
+ ``` php
88
+ use Binafy\PhpColorGenerator\Color;
89
+
90
+ Color::generateShades('1363df', 10);
91
+ ```
92
+
93
+ #### ` generateTints(string $hex, int $times): array `
94
+
95
+ If you want to generate tints from hex color, you can use ` generateTints() ` method:
96
+
97
+ ``` php
98
+ use Binafy\PhpColorGenerator\Color;
99
+
100
+ Color::generateTints('1363df', 10);
101
+ ```
102
+
103
+ #### ` generateDarkBrightColors(string $hex, int $times = 10): array `
104
+
105
+ If you want to generate tints, shades from hex color, you can use ` generateDarkBrightColors() ` method:
106
+
107
+ ``` php
108
+ use Binafy\PhpColorGenerator\Color;
109
+
110
+ Color::generateDarkBrightColors('1363df', 10); // array ('dark', 'light')
111
+ ```
112
+
54
113
<a name =" security " ></a >
55
114
## Security
56
115
0 commit comments