anthocodeur/multicolors-converter
最新稳定版本:2.1.0
Composer 安装命令:
composer require anthocodeur/multicolors-converter
包简介
A very simple tool to convert colors into differents formats
README 文档
README
ColorConverter is a modern PHP package that provides robust and precise conversions between various color formats, including Hexadecimal, RGB, and RAL color systems. Leveraging encapsulated converters (HexConverter, RalConverter, RgbConverter), it enables easy and precise manipulation of colors.
Installation
Install this package easily via Composer:
composer require anthocodeur/multicolors-converter
Usage
You can use the static methods provided by the dedicated converter classes to convert colors between different formats.
Convert Hexadecimal to RGB
use ColorConverter\HexConverter; $hex = '#FF0000'; $rgb = HexConverter::hexToRgb($hex); print_r($rgb); // ['R' => 255, 'G' => 0, 'B' => 0]
Convert RGB to Hexadecimal
use ColorConverter\RgbConverter; $r = 255; $g = 0; $b = 0; $hex = RgbConverter::rgbToHex($r, $g, $b); echo $hex; // #ff0000
Convert RGB to RAL
use ColorConverter\RalConverter; $r = 255; $g = 0; $b = 0; $ral = RalConverter::rgbToRalValue($r, $g, $b); echo $ral; // e.g., RAL1000
Convert RAL to RGB
use ColorConverter\RalConverter; $ral = 'RAL1000'; $rgb = RalConverter::ralToRgb($ral); print_r($rgb); // ['R' => 203, 'G' => 186, 'B' => 136]
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines on how to contribute to this project.
License
This package is open-source software licensed under the MIT License. See the LICENSE file for details.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-10