binafy / php-color-generator
Generate colors with PHP
Requires
- php: ^7.3|^8.0
Requires (Dev)
- phpunit/phpunit: ^9.4
README
Introduction
The PHP Color Generator
is a versatile PHP package designed for easy and efficient color manipulation. Whether you're working with color schemes, themes, or UI designs, this package provides a set of utilities to convert, darken, lighten, and generate shades or tints of colors. It supports the conversion of hex to RGB and vice versa, allows for adjusting the lightness or darkness of colors, and can generate a series of tints or shades based on a base color. Ideal for designers and developers who need to programmatically handle color variations for dynamic interfaces or applications.
Requirements
PHP >= 7.3
Installation
You can install the package with Composer.
composer require binafy/php-color-generator
Usage
hexToRGB(string $hex): array
If you may convert hex to RGB, you need to use hexToRGB()
method:
use Binafy\PhpColorGenerator\Color; Color::hexToRGB('1363df');
rgbToHex(string $hex): string
If you may convert RGB to hex, you need to use rgbToHex()
method:
use Binafy\PhpColorGenerator\Color; Color::rgbToHex([ 'red' => '19', 'green' => '99', 'blue' => '223', ]);
darken(array $rgb, float $percentage): array
If you may get darken rgb color, you can use darken()
method:
use Binafy\PhpColorGenerator\Color; Color::darken([ 'red' => '19', 'green' => '99', 'blue' => '223', ], 0.5); // array ('red', 'blue', 'green')
lighten(array $rgb, float $percentage): array
If you may get lighten rgb color, you can use lighten()
method:
use Binafy\PhpColorGenerator\Color; Color::lighten([ 'red' => '19', 'green' => '99', 'blue' => '223', ], 0.5); // array ('red', 'blue', 'green')
generateShades(string $hex, int $times): array
If you want to generate shades from hex color, you can use generateShades()
method:
use Binafy\PhpColorGenerator\Color; Color::generateShades('1363df', 10);
generateTints(string $hex, int $times): array
If you want to generate tints from hex color, you can use generateTints()
method:
use Binafy\PhpColorGenerator\Color; Color::generateTints('1363df', 10);
generateDarkBrightColors(string $hex, int $times = 10): array
If you want to generate tints, shades from hex color, you can use generateDarkBrightColors()
method:
use Binafy\PhpColorGenerator\Color; Color::generateDarkBrightColors('1363df', 10); // array ('dark', 'light')
Security
If you discover any security-related issues, please email binafy23@gmail.com
instead of using the issue tracker.
Changelog
The changelog can be found in the CHANGELOG.md
file of the GitHub repository. It lists the changes, bug fixes, and improvements made to each version of the Laravel User Monitoring package.
License
The MIT License (MIT). Please see License File for more information.
Star History
Conclusion
Congratulations! You have successfully installed and integrated the Laravel User Monitoring package into your Laravel application. By effectively logging and analyzing user activity, you can gain valuable insights that can help you improve your application's user experience and performance. If you have any questions or need further assistance, please refer to the documentation or seek help from the package's GitHub repository. Happy monitoring!
Donate
If this package is helpful for you, you can buy a coffee for me :) ❤️
- Iranian Gateway: https://daramet.com/milwad_khosravi
- Paypal Gateway: SOON
- MetaMask Address:
0xf208a562c5a93DEf8450b656c3dbc1d0a53BDE58