anthocodeur/multicolors-converter

A very simple tool to convert colors into differents formats

v1.0.1 2024-02-14 06:22 UTC

This package is auto-updated.

Last update: 2024-09-14 07:30:07 UTC


README

ColorConverter is a package that allows you to convert hexadecimal values to RGB, RGB to RAL, and other combinations.

Installation

You can install this package via Composer. Run the following command:

composer require anthocodeur/multicolors-converter

Usage

To use this package, you can utilize the provided static methods to convert between different color formats. Here are some examples:

Convert Hexadecimal to RGB

use ColorConverter\ColorConverter;

$hex = '#FF0000';
$rgb = ColorConverter::hexToRgb($hex);
print_r($rgb); // Output: ['R' => 255, 'G' => 0, 'B' => 0]

Convert RGB to Hexadecimal

use ColorConverter\ColorConverter;

$r = 255;
$g = 0;
$b = 0;
$hex = ColorConverter::rgbToHex($r, $g, $b);
echo $hex; // Output: #ff0000

Convert RGB to RAL

use ColorConverter\ColorConverter;

$r = 255;
$g = 0;
$b = 0;
$ral = ColorConverter::rgbToRalValue($r, $g, $b);
echo $ral; // Output: RALXXXX (RAL color code)

Convert RAL to RGB

use ColorConverter\ColorConverter;

$ral = 'RAL1000';
$rgb = ColorConverter::ralToRgbMetas($ral);
print_r($rgb); // Output: ['R' => 203, 'G' => 186, 'B' => 136]

Contributing

Contributions are welcome! Please read the contributing guidelines for details on how to contribute to this project.

License

This package is open-source software licensed under the MIT License