Skip to content

Commit

Permalink
feat(frontend): update app icon
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Feb 2, 2024
1 parent 5f8f33e commit b73cf33
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
5 changes: 5 additions & 0 deletions packages/frontend/assets/app-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions packages/frontend/assets/touch-icon.svg

This file was deleted.

2 changes: 1 addition & 1 deletion packages/frontend/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fileURLToPath } from "node:url";

export const assetsPath = fileURLToPath(new URL("assets", import.meta.url));
export { touchIcon } from "./lib/touch-icon.js";
export { appIcon } from "./lib/app-icon.js";
export { templates } from "./lib/nunjucks.js";
export { styles } from "./lib/lightningcss.js";
export { scripts } from "./lib/rollup.js";
3 changes: 1 addition & 2 deletions packages/frontend/layouts/default.njk
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
<meta name="supported-color-schemes" content="light dark">

<link rel="alternate" href="{{ application.url }}/feed.jf2" type="application/jf2feed+json" title="JF2 Feed">
<link rel="apple-touch-icon" href="{{ application.url }}{{ assetPath | default("/assets") }}/app.png">
<link rel="apple-touch-icon" href="{{ application.url }}{{ assetPath | default("/assets") }}/app-icon-180.png">
<link rel="icon" href="{{ application.url }}{{ assetPath | default("/assets") }}/icon.svg">
<link rel="mask-icon" href="{{ application.url }}{{ assetPath | default("/assets") }}/icon.svg" color="{{ application.themeColor }}">
<link rel="preload" href="{{ application.url }}{{ assetPath | default("/assets") }}/mona-sans.woff2" as="font" type="font/woff2" crossorigin>
<link rel="stylesheet" href="{{ application.url }}{{ assetPath | default("/assets") }}/app.css">
<link rel="manifest" href="{{ application.url }}/app.webmanifest">
Expand Down
16 changes: 16 additions & 0 deletions packages/frontend/lib/app-icon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import fs from "node:fs";
import { fileURLToPath } from "node:url";
import sharp from "sharp";

export const appIcon = async (themeColor, size) => {
const svgPath = fileURLToPath(
new URL("../assets/app-icon.svg", import.meta.url),
);

const svg = fs.readFileSync(svgPath);
return sharp(svg)
.tint(themeColor)
.resize(size)
.png({ colours: 16 })
.toBuffer();
};
12 changes: 0 additions & 12 deletions packages/frontend/lib/touch-icon.js

This file was deleted.

0 comments on commit b73cf33

Please sign in to comment.