*/ public static function brandColors(): array { return [ 'Petrol' => ['#0F4C5C'], 'Magenta' => ['#E20074'], 'Gelb' => ['#F5C400'], 'Blau' => ['#2563EB'], 'Grau' => ['#666666'], ]; } #[DataProvider('brandColors')] public function test_brand_color_is_kept_exactly_on_shade_600(string $color): void { $palette = ColorPalette::fromHex($color); $this->assertSame([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950], array_keys($palette)); $this->assertSame(strtoupper($color), $palette[600]); foreach ($palette as $hex) { $this->assertMatchesRegularExpression('/^#[0-9A-F]{6}$/', $hex); } } #[DataProvider('brandColors')] public function test_shades_get_darker_from_50_to_950(string $color): void { $palette = array_values(ColorPalette::fromHex($color)); for ($i = 1; $i < count($palette); $i++) { $this->assertGreaterThan( ColorPalette::contrast($palette[$i - 1], '#FFFFFF'), ColorPalette::contrast($palette[$i], '#FFFFFF'), ); } } public function test_foreground_is_readable(): void { $this->assertSame('#FFFFFF', ColorPalette::foregroundFor('#0F4C5C')); $this->assertSame('#111111', ColorPalette::foregroundFor('#F5C400')); } public function test_invalid_colors_are_rejected(): void { $this->expectException(InvalidArgumentException::class); ColorPalette::fromHex('rot'); } }