feat: rebrand app and packaging icons to new Motionity logo
Sync Gitea releases to GitHub / sync-releases (push) Canceled after 0s
Sync Gitea releases to GitHub / sync-releases (push) Canceled after 0s
Swap the small icon mark, README banner, packaged app icon, and favicon over to the new brand assets. make-icon.cjs and the new make-favicon.cjs re-derive their bar geometry/colours from src/assets/logo.svg instead of the old white-bars mark. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+11
-12
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
// Renders build/icon.png (512x512) from the same geometry as
|
||||
// src/assets/logo.svg: three white rounded bars on the app's dark background.
|
||||
// src/assets/logo.svg: three coloured rounded bars on the app's dark background.
|
||||
//
|
||||
// Hand-rolled so packaging needs no image toolchain (no ImageMagick, no sharp).
|
||||
// electron-builder derives the Windows .ico and the Linux icon set from it.
|
||||
@@ -12,15 +12,14 @@ const { join, resolve } = require('node:path');
|
||||
const SIZE = 512;
|
||||
const SS = 4; // supersampling factor, for antialiased edges
|
||||
const BG = [0x14, 0x16, 0x29];
|
||||
const FG = [0xff, 0xff, 0xff];
|
||||
const BG_RADIUS = 96; // squircle-ish corner on the icon plate
|
||||
|
||||
// viewBox="0 0 24 19" in src/assets/logo.svg
|
||||
const VIEW = { w: 24, h: 19 };
|
||||
// viewBox="0 0 157 183" in src/assets/logo.svg
|
||||
const VIEW = { w: 157, h: 183 };
|
||||
const BARS = [
|
||||
{ x: 17.3193, y: 8.36011, w: 6.08, h: 10.64, r: 3.04 },
|
||||
{ x: 8.95996, y: 0, w: 6.08, h: 19, r: 3.04 },
|
||||
{ x: 0.599609, y: 0, w: 6.08, h: 19, r: 3.04 },
|
||||
{ x: 79, y: 0, w: 79, h: 47, r: 23.5, fg: [0x75, 0x4b, 0xff] },
|
||||
{ x: 0, y: 68, w: 157, h: 47, r: 23.5, fg: [0x60, 0x2f, 0xff] },
|
||||
{ x: 0, y: 136, w: 79, h: 47, r: 23.5, fg: [0x06, 0x93, 0xc0] },
|
||||
];
|
||||
|
||||
function insideRoundedRect(px, py, { x, y, w, h, r }) {
|
||||
@@ -43,7 +42,7 @@ for (let py = 0; py < SIZE; py++) {
|
||||
raw[rowStart] = 0;
|
||||
for (let px = 0; px < SIZE; px++) {
|
||||
let plateHits = 0;
|
||||
let barHits = 0;
|
||||
const colorSum = [0, 0, 0];
|
||||
for (let sy = 0; sy < SS; sy++) {
|
||||
for (let sx = 0; sx < SS; sx++) {
|
||||
const fx = px + (sx + 0.5) / SS;
|
||||
@@ -52,16 +51,16 @@ for (let py = 0; py < SIZE; py++) {
|
||||
plateHits++;
|
||||
const lx = (fx - offsetX) / scale;
|
||||
const ly = (fy - offsetY) / scale;
|
||||
if (BARS.some((bar) => insideRoundedRect(lx, ly, bar))) barHits++;
|
||||
const bar = BARS.find((b) => insideRoundedRect(lx, ly, b));
|
||||
const pixel = bar ? bar.fg : BG;
|
||||
for (let c = 0; c < 3; c++) colorSum[c] += pixel[c];
|
||||
}
|
||||
}
|
||||
const total = SS * SS;
|
||||
const alpha = Math.round((plateHits / total) * 255);
|
||||
// Blend bar coverage over the plate colour; alpha carries the plate edge.
|
||||
const mix = plateHits ? barHits / plateHits : 0;
|
||||
const o = rowStart + 1 + px * 4;
|
||||
for (let c = 0; c < 3; c++) {
|
||||
raw[o + c] = Math.round(BG[c] + (FG[c] - BG[c]) * mix);
|
||||
raw[o + c] = plateHits ? Math.round(colorSum[c] / plateHits) : 0;
|
||||
}
|
||||
raw[o + 3] = alpha;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user