add apple music fonts

This commit is contained in:
Eduard Prigoana 2026-02-14 16:43:05 +00:00
parent 1e519002be
commit 615f5dc8bd
9 changed files with 117 additions and 15 deletions

View file

@ -19,6 +19,20 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="Monochrome" /> <meta name="apple-mobile-web-app-title" content="Monochrome" />
<meta name="description" content="A minimalist music streaming application" /> <meta name="description" content="A minimalist music streaming application" />
<!-- Preconnect to critical third-party origins -->
<link rel="preconnect" href="https://api.fonts.coollabs.io" crossorigin />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://api.monochrome.tf" crossorigin />
<link rel="preconnect" href="https://ws.audioscrobbler.com" crossorigin />
<link rel="preconnect" href="https://libre.fm" crossorigin />
<link rel="preconnect" href="https://api.listenbrainz.org" crossorigin />
<link rel="preconnect" href="https://www.gstatic.com" crossorigin />
<link rel="preconnect" href="https://resources.tidal.com" crossorigin />
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
<link rel="preconnect" href="https://unpkg.com" crossorigin />
<link rel="apple-touch-icon" href="/assets/logo.svg" /> <link rel="apple-touch-icon" href="/assets/logo.svg" />
<link rel="manifest" href="/manifest.json" /> <link rel="manifest" href="/manifest.json" />
<link rel="icon" href="/assets/logo.svg" type="image/svg+xml" /> <link rel="icon" href="/assets/logo.svg" type="image/svg+xml" />
@ -758,6 +772,7 @@
<aside class="sidebar"> <aside class="sidebar">
<div class="sidebar-content"> <div class="sidebar-content">
<div class="sidebar-logo"> <div class="sidebar-logo">
<a href="https://monochrome.tf/" class="sidebar-logo-link">
<svg <svg
class="app-logo" class="app-logo"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -772,6 +787,7 @@
</g> </g>
</svg> </svg>
<span>Monochrome</span> <span>Monochrome</span>
</a>
<button <button
id="sidebar-toggle" id="sidebar-toggle"
class="btn-icon desktop-only" class="btn-icon desktop-only"
@ -2333,6 +2349,7 @@
<div id="font-preset-section" class="font-section"> <div id="font-preset-section" class="font-section">
<select id="font-preset-select"> <select id="font-preset-select">
<option value="Inter">Inter (Default)</option> <option value="Inter">Inter (Default)</option>
<option value="Apple Music">Apple Music</option>
<option value="IBM Plex Mono">IBM Plex Mono</option> <option value="IBM Plex Mono">IBM Plex Mono</option>
<option value="Roboto">Roboto</option> <option value="Roboto">Roboto</option>
<option value="Open Sans">Open Sans</option> <option value="Open Sans">Open Sans</option>

View file

@ -1943,6 +1943,8 @@ function initializeFontSettings() {
); );
} else if (value === 'monospace') { } else if (value === 'monospace') {
fontSettings.loadPresetFont('monospace', 'monospace'); fontSettings.loadPresetFont('monospace', 'monospace');
} else if (value === 'Apple Music') {
fontSettings.loadAppleMusicFont();
} else { } else {
fontSettings.loadPresetFont(value, 'sans-serif'); fontSettings.loadPresetFont(value, 'sans-serif');
} }

View file

@ -1659,6 +1659,41 @@ export const fontSettings = {
document.documentElement.style.setProperty('--font-family', fontValue); document.documentElement.style.setProperty('--font-family', fontValue);
}, },
loadAppleMusicFont() {
const APPLE_FONT_LINK_ID = 'monochrome-apple-font';
// Remove any existing dynamic font links
let existingLink = document.getElementById(this.FONT_LINK_ID);
if (existingLink) {
existingLink.remove();
}
// Remove any existing @font-face styles
let existingStyle = document.getElementById(this.FONT_FACE_ID);
if (existingStyle) {
existingStyle.remove();
}
// Load Apple font CSS
let link = document.getElementById(APPLE_FONT_LINK_ID);
if (!link) {
link = document.createElement('link');
link.id = APPLE_FONT_LINK_ID;
link.rel = 'stylesheet';
link.href = '/fonts/apple/sf-pro-display.css';
document.head.appendChild(link);
}
this.setConfig({
type: 'preset',
family: 'Apple Music',
fallback: 'sans-serif',
weights: [400, 500, 600, 700],
});
document.documentElement.style.setProperty('--font-family', "'SF Pro Display', sans-serif");
},
applyFont() { applyFont() {
const config = this.getConfig(); const config = this.getConfig();
@ -1674,7 +1709,11 @@ export const fontSettings = {
break; break;
case 'preset': case 'preset':
default: default:
if (config.family === 'Apple Music') {
this.loadAppleMusicFont();
} else {
this.loadPresetFont(config.family, config.fallback); this.loadPresetFont(config.family, config.fallback);
}
break; break;
} }
}, },

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,36 @@
/**
* Apple Fonts - SF Pro Display
* Fonts sourced from Apple Music design system
*/
@font-face {
font-family: 'SF Pro Display';
src: url('SFPRODISPLAYREGULAR.woff2') format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'SF Pro Display';
src: url('SFPRODISPLAYMEDIUM.woff2') format('woff2');
font-weight: 500;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'SF Pro Display';
src: url('SFPRODISPLAYBOLD.woff2') format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'SF Pro Display';
src: url('SFPRODISPLAYSEMIBOLDITALIC.woff2') format('woff2');
font-weight: 600;
font-style: italic;
font-display: swap;
}

View file

@ -440,6 +440,14 @@ kbd {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.sidebar-logo-link {
display: flex;
align-items: center;
gap: 6px;
color: inherit;
text-decoration: none;
}
.sidebar-logo .app-logo { .sidebar-logo .app-logo {
width: 15px; width: 15px;
height: 15px; height: 15px;