From 471798a8791089ca795a880de9b64855dff5aa67 Mon Sep 17 00:00:00 2001 From: Max Hollmann Date: Thu, 21 May 2026 19:12:37 +0200 Subject: [PATCH] Add LINKS_CSS env var for custom CSS injection Lets users tweak font size, colors, spacing, etc. without rebuilding the bundle. Addresses issue #3 (font size request) while handling any future styling requests with a single general-purpose escape hatch. Co-Authored-By: Claude Sonnet 4.6 --- README.md | 8 ++++++++ src/App.svelte | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 31acba3..0d1d831 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,14 @@ The page title is set using the `LINKS_TITLE` environment variable. Set `LINKS_NEW_TAB=true` (or `1`) to open all links in a new browser tab instead of the current tab. +#### Custom CSS + +Set `LINKS_CSS` to inject arbitrary CSS into the page. Useful for tweaking font size, colors, spacing, etc. without rebuilding the bundle. Example: + +``` +LINKS_CSS=":root { font-size: 18px; }" +``` + #### Links Links have a name, URL, icon (optional), and sort index (optional). A link to this repo could be configured in various ways: diff --git a/src/App.svelte b/src/App.svelte index 4c0d373..fd6e84c 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -9,6 +9,12 @@ let links = getLinks(env); let title = env.LINKS_TITLE || 'Links'; let newTab = env.LINKS_NEW_TAB === 'true' || env.LINKS_NEW_TAB === '1'; + + if (env.LINKS_CSS) { + const style = document.createElement('style'); + style.textContent = env.LINKS_CSS; + document.head.appendChild(style); + } let search = ""; let searchElement; let activeElement = null;