Skip to content

Commit

Permalink
always add a background color to the apple touch icon
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikbosch committed Sep 13, 2023
1 parent 97064e4 commit 91f74c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/favicon-generator
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ final class CliContext
writeln('Options:');
writeln('--icon-background Set color under icon, defaults to transparent');
writeln('--theme-color Color to used in manifest `theme_color` and default letter background color, defaults to #00AAAD');
writeln('--tile-color Color to used in manifest `background_color` and used fill ms-tiles with, defaults to #00AAAD');
writeln('--tile-color Color to used in manifest `background_color` and used fill apple touch and ms-tiles with, defaults to #00AAAD');
writeln('--letter-color Color of the letter, used when using letter: input, defaults to #FFFFFF');
writeln('--letter-background Color of the background, used when using letter: input, defaults to theme color');
writeln('--root Location inside the root directory where the favicons are saved to, defaults to /');
Expand Down
2 changes: 1 addition & 1 deletion src/ApplePackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct(

public function package(Input $input, WebApplicationManifest $manifest, string $rootPrefix): \Generator
{
$generator = new AppleTouchGenerator($input, $this->size);
$generator = new AppleTouchGenerator($input, $this->size, $manifest->backgroundColor);
yield 'apple-touch-icon.png' => $generator->generate();

$generator = AppleSafariPinGenerator::cliDetectImageMagickVersion($input);
Expand Down
3 changes: 2 additions & 1 deletion src/AppleTouchGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ final class AppleTouchGenerator implements GeneratorInterface
public function __construct(
private readonly Input $input,
private readonly int $size,
private readonly string $backgroundColor,
) {
}

Expand All @@ -25,7 +26,7 @@ public function generate(): string
$composite->newImage($newWidth + 2 * $padding, $newHeight + 2 * $padding, new \ImagickPixel('none'));

$paddingDraw = new \ImagickDraw();
$paddingDraw->setFillColor(new \ImagickPixel($this->input->backgroundColor));
$paddingDraw->setFillColor(new \ImagickPixel($this->backgroundColor));
$paddingDraw->roundRectangle(
0,
0,
Expand Down

0 comments on commit 91f74c7

Please sign in to comment.