Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Jul 2, 2022
1 parent 32b2255 commit aaabbd6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nova.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function color(string $foreground, string $background): string
{
$palletes = ['light' => '255, 255, 255', 'dark' => '12, 74, 110'];

$background = Arr::get($palletes, $background, $background);
$background = $palletes[$background] ?? $background;

$rgba = function ($color) {
return tap(
Expand Down
15 changes: 15 additions & 0 deletions tests/Unit/ColorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,31 @@ public function colorDataProvider()
yield ['24, 182, 155', 'light', '24, 182, 155'];
yield ['24, 182, 155', 'dark', '24, 182, 155'];

yield ['24, 182, 155', '255, 255, 255', '24, 182, 155'];
yield ['24, 182, 155', '0, 0, 0', '24, 182, 155'];

yield ['24, 182, 155, 0.1', 'light', '232, 248, 245'];
yield ['24, 182, 155, 0.1', 'dark', '13, 85, 115'];

yield ['24, 182, 155, 0.1', '255, 255, 255', '232, 248, 245'];
yield ['24, 182, 155, 0.1', '0, 0, 0', '2, 18, 16'];

yield ['24, 182, 155, 0.5', 'light', '140, 219, 205'];
yield ['24, 182, 155, 0.5', 'dark', '18, 128, 133'];

yield ['24, 182, 155, 0.5', '255, 255, 255', '140, 219, 205'];
yield ['24, 182, 155, 0.5', '0, 0, 0', '12, 91, 78'];

yield ['24, 182, 155, 0.75', 'light', '82, 200, 180'];
yield ['24, 182, 155, 0.75', 'dark', '21, 155, 144'];

yield ['24, 182, 155, 0.75', '255, 255, 255', '82, 200, 180'];
yield ['24, 182, 155, 0.75', '0, 0, 0', '18, 137, 116'];

yield ['24, 182, 155, 1.25', 'light', '24, 182, 155'];
yield ['24, 182, 155, 1.25', 'dark', '24, 182, 155'];

yield ['24, 182, 155, 1.25', '255, 255, 255', '24, 182, 155'];
yield ['24, 182, 155, 1.25', '0, 0, 0', '24, 182, 155'];
}
}

0 comments on commit aaabbd6

Please sign in to comment.