Skip to content

Commit f29fb84

Browse files
authored
Merge pull request #9 from 8fold/fix-metro-tile-color
Fix metro tile color
2 parents 20b4579 + 94563ef commit f29fb84

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

src/Components/Favicons.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Favicons implements Stringable
2121

2222
private bool $metroUsesWhite;
2323

24-
private FaviconMetroColors $metroTileColor = FaviconMetroColors::DarkOrange;
24+
private FaviconMetroColors|string $metroTileColor = FaviconMetroColors::DarkOrange;
2525

2626
private string $safariThemeColor = '#5bbad5';
2727

@@ -70,7 +70,7 @@ private function hasAppName(): bool
7070
}
7171

7272
public function withMetro(
73-
FaviconMetroColors $tileColor = FaviconMetroColors::DarkOrange,
73+
FaviconMetroColors|string $tileColor = FaviconMetroColors::DarkOrange,
7474
bool $useWhite = false
7575
): self {
7676
$this->metroTileColor = $tileColor;
@@ -98,6 +98,14 @@ private function metroUsesWhite(): bool
9898
return $this->metroUsesWhite;
9999
}
100100

101+
private function metroTileColor(): string
102+
{
103+
if (is_string($this->metroTileColor)) {
104+
return $this->metroTileColor;
105+
}
106+
return $this->metroTileColor->value;
107+
}
108+
101109
public function withSafariThemeColor(string $color): self
102110
{
103111
$this->safariThemeColor = $color;
@@ -135,7 +143,7 @@ public function __toString(): string
135143
),
136144
Element::meta()->omitEndTag()->props(
137145
'name msapplication-TileColor',
138-
'content ' . $this->metroTileColor->value
146+
'content ' . $this->metroTileColor()
139147
),
140148
Element::meta()->omitEndTag()->props(
141149
'name theme-color',

tests/Components/CopyrightTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ public function can_have_year_range(): void
6868

6969
/**
7070
* @test
71-
*
72-
* @group focus
7371
*/
7472
public function can_include_copyright(): void
7573
{

tests/Components/FaviconsTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,18 @@ public function can_use_windows_metro_settings(): void
9999
$expected,
100100
$result . "\n"
101101
);
102+
103+
$expected = file_get_contents(
104+
__DIR__ . '/favicons-windows-metro-tile-color-white.xml'
105+
);
106+
107+
$result = (string) Favicons::create()->withMetro(
108+
'#ffffff'
109+
);
110+
111+
$this->assertSame(
112+
$expected,
113+
$result . "\n"
114+
);
102115
}
103116
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180"><link type="image/png" rel="icon" href="/favicon-32x32.png" sizes="32x32"><link type="image/png" rel="icon" href="/favicon-16x16.png" sizes="16x16"><link rel="manifest" href="/site.webmanifest"><meta name="msapplication-TileColor" content="#ffffff"><meta name="theme-color" content="#ffffff"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">

0 commit comments

Comments
 (0)