Color palette support in byos_laravel

This commit is contained in:
Dan van Kley 2025-11-17 20:48:06 -05:00
parent c157dcf3b6
commit 9ee7bc1aac
7 changed files with 236 additions and 4 deletions

31
app/Enums/PaletteName.php Normal file
View 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');
}
}
}