mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 23:18:10 +00:00
Color palette support in byos_laravel
This commit is contained in:
parent
c157dcf3b6
commit
9ee7bc1aac
7 changed files with 236 additions and 4 deletions
31
app/Enums/PaletteName.php
Normal file
31
app/Enums/PaletteName.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Bnussbau\TrmnlPipeline\Data\RgbColor;
|
||||
use InvalidArgumentException;
|
||||
|
||||
enum PaletteName: string
|
||||
{
|
||||
case SPECTRA_6 = 'spectra_6';
|
||||
|
||||
/**
|
||||
* @return RgbColor[]
|
||||
*/
|
||||
public static function getPalette(PaletteName $palette): array
|
||||
{
|
||||
switch ($palette) {
|
||||
case PaletteName::SPECTRA_6:
|
||||
return [
|
||||
RgbColor::fromComponents(0, 0, 0),
|
||||
RgbColor::fromComponents(255, 255, 255),
|
||||
RgbColor::fromComponents(255, 255, 0),
|
||||
RgbColor::fromComponents(255, 0, 0),
|
||||
RgbColor::fromComponents(0, 255, 0),
|
||||
RgbColor::fromComponents(0, 0, 255),
|
||||
];
|
||||
default:
|
||||
throw new InvalidArgumentException('Invalid palette name');
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue