ypho/colors

Colors 是一个包含 22 个色彩方案的轻量级包。每个方案包含从浅到深的十种色调。

1.1.1 2022-01-05 08:54 UTC

This package is auto-updated.

Last update: 2024-09-05 17:06:41 UTC


README

License GitHub Workflow Status Code Size Latest Release

Colors 是一个包含 22 个色彩方案的轻量级包。每个方案包含从浅到深的十种色调。这些颜色基于 TailwindCSS 颜色。

安装

composer require ypho/colors

使用方法

// Return given color
$regularRed = Color::getSingleColor('red'); // #ef4444

// Return given color, but a darker shade of red
$amazonGreen = Color::getSingleColor('green', 8); // #166534

// Returns a palette of 10 shades of the given color
$teal = Color::getColorPalette('teal'); // ['#f0fdfa' ... '#134e4a']

// Returns all colors, in a light shade
$lightColors = Color::getColorsByShade(2); // ['#e2e8f0' ... '#fecdd3']

// Same as above, but take only three colors
$trafficLight = Color::getColorsByShade(6, ['red', 'orange', 'green']); // ['#dc2626', '#f97316', '#22c55e']

捐赠

BTC ETH