adding new themes

This commit is contained in:
schmeeve
2026-09-23 12:04:15 -07:00
parent 86f37e1540
commit 16c033e574
2 changed files with 89 additions and 6 deletions

View File

@@ -93,6 +93,78 @@ html, [data-theme="dark"] {
--danger: #f87171; --input-bg: #251420; --bg-hover: #352030;
}
/* ── Urban Slate ─────────────────────────────────────── */
[data-theme="urban-slate"] {
--bg: #eef0f3; --surface: #ffffff; --border: #d4d8de;
--text: #2b3038; --muted: #6b7480;
--primary: #4a6a8a; --primary-bg: #3d5a75; --primary-dark: #2f4a60; --on-primary: #ffffff;
--danger: #c0392b; --input-bg: #ffffff; --bg-hover: #e2e6ec;
}
/* ── Frozen Mist ─────────────────────────────────────── */
[data-theme="frozen-mist"] {
--bg: #eef0f2; --surface: #fcfcfd; --border: #dfe3e8;
--text: #33383e; --muted: #828a94;
--primary: #c96f3a; --primary-bg: #b85f2e; --primary-dark: #9c4f24; --on-primary: #ffffff;
--danger: #c0392b; --input-bg: #ffffff; --bg-hover: #e3e7ec;
}
/* ── Yacht ───────────────────────────────────────────── */
[data-theme="yacht"] {
--bg: #e9edf2; --surface: #ffffff; --border: #ccd4de;
--text: #26303c; --muted: #6d7986;
--primary: #33517a; --primary-bg: #2a4466; --primary-dark: #1f3550; --on-primary: #ffffff;
--danger: #b24436; --input-bg: #ffffff; --bg-hover: #dde3ea;
}
/* ── Copper ──────────────────────────────────────────── */
[data-theme="copper"] {
--bg: #f3ede6; --surface: #fdfaf5; --border: #e0d3c2;
--text: #3a2f26; --muted: #8c7f70;
--primary: #b5653b; --primary-bg: #a5552f; --primary-dark: #8a4625; --on-primary: #ffffff;
--danger: #c0392b; --input-bg: #ffffff; --bg-hover: #e9dfd2;
}
/* ── Marina ──────────────────────────────────────────── */
[data-theme="marina"] {
--bg: #eaf0f4; --surface: #ffffff; --border: #d2dde5;
--text: #24303c; --muted: #6f7f8c;
--primary: #1f4e6e; --primary-bg: #1a425c; --primary-dark: #12344a; --on-primary: #ffffff;
--danger: #b2432f; --input-bg: #ffffff; --bg-hover: #dee7ee;
}
/* ── Neptune ─────────────────────────────────────────── */
[data-theme="neptune"] {
--bg: #e7f1f4; --surface: #ffffff; --border: #cde0e6;
--text: #1f2f36; --muted: #6d838c;
--primary: #2f7fa0; --primary-bg: #276f8e; --primary-dark: #1e5c77; --on-primary: #ffffff;
--danger: #c0392b; --input-bg: #ffffff; --bg-hover: #d9e8ec;
}
/* ── Sapphire ────────────────────────────────────────── */
[data-theme="sapphire"] {
--bg: #eef0f6; --surface: #ffffff; --border: #dcdde8;
--text: #2d3440; --muted: #787f8e;
--primary: #5a73a6; --primary-bg: #4d6395; --primary-dark: #3d5078; --on-primary: #ffffff;
--danger: #c0553d; --input-bg: #ffffff; --bg-hover: #e2e4ee;
}
/* ── Tropical ────────────────────────────────────────── */
[data-theme="tropical"] {
--bg: #f2efe6; --surface: #fdfaf2; --border: #e0d9c2;
--text: #28302e; --muted: #7d8680;
--primary: #e76f51; --primary-bg: #d95f41; --primary-dark: #c04e33; --on-primary: #ffffff;
--danger: #c0392b; --input-bg: #ffffff; --bg-hover: #e9e4d4;
}
/* ── Gossamer ────────────────────────────────────────── */
[data-theme="gossamer"] {
--bg: #eceef1; --surface: #ffffff; --border: #d8dce2;
--text: #2c3238; --muted: #77808a;
--primary: #3aa6a0; --primary-bg: #2f918b; --primary-dark: #257771; --on-primary: #ffffff;
--danger: #d0563a; --input-bg: #ffffff; --bg-hover: #e0e4e9;
}
* { box-sizing: border-box; }
body {

View File

@@ -20,6 +20,15 @@ const THEMES = [
{ id: "catppuccin", label: "Catppuccin", dark: true, dots: ["#1e1e2e", "#26263a", "#cba6f7"] },
{ id: "one-dark", label: "One Dark", dark: true, dots: ["#21252b", "#282c34", "#61afef"] },
{ id: "sunset", label: "Sunset", dark: true, dots: ["#1c1018", "#251420", "#f472b6"] },
{ id: "urban-slate", label: "Urban Slate", dark: false, dots: ["#eef0f3", "#ffffff", "#4a6a8a"] },
{ id: "frozen-mist", label: "Frozen Mist", dark: false, dots: ["#eef0f2", "#fcfcfd", "#c96f3a"] },
{ id: "yacht", label: "Yacht", dark: false, dots: ["#e9edf2", "#ffffff", "#33517a"] },
{ id: "copper", label: "Copper", dark: false, dots: ["#f3ede6", "#fdfaf5", "#b5653b"] },
{ id: "marina", label: "Marina", dark: false, dots: ["#eaf0f4", "#ffffff", "#1f4e6e"] },
{ id: "neptune", label: "Neptune", dark: false, dots: ["#e7f1f4", "#ffffff", "#2f7fa0"] },
{ id: "sapphire", label: "Sapphire", dark: false, dots: ["#eef0f6", "#ffffff", "#5a73a6"] },
{ id: "tropical", label: "Tropical", dark: false, dots: ["#f2efe6", "#fdfaf2", "#e76f51"] },
{ id: "gossamer", label: "Gossamer", dark: false, dots: ["#eceef1", "#ffffff", "#3aa6a0"] },
];
const THEME_CONFIG_KEY = "snotes-theme-config";
const themeMQ = window.matchMedia("(prefers-color-scheme: dark)");
@@ -43,28 +52,30 @@ function activeThemeId() {
return themeConfig.mode === "auto" ? (themeMQ.matches ? themeConfig.dark : themeConfig.light) : themeConfig.manual;
}
function applyTheme() {
function applyTheme(labelEl, swatchEl) {
const id = activeThemeId();
document.documentElement.setAttribute("data-theme", id);
const t = findTheme(id);
const label = document.querySelector(".theme-label");
const swatch = document.querySelector(".theme-btn .theme-swatch");
const label = labelEl || document.querySelector(".theme-label");
const swatch = swatchEl || document.querySelector(".theme-btn .theme-swatch");
if (label) label.textContent = t ? t.label : "";
if (swatch && t) swatch.innerHTML = t.dots.map((c) => `<span class="theme-dot" style="background:${c}"></span>`).join("");
}
function themeSelector() {
const sel = el("div", { class: "theme-selector" });
const swatchEl = el("span", { class: "theme-swatch" });
const labelEl = el("span", { class: "theme-label" });
const btn = el("button", { class: "theme-btn", title: "Change theme" }, [
el("span", { class: "theme-swatch" }),
el("span", { class: "theme-label" }),
swatchEl,
labelEl,
el("span", { class: "chevron", html: "&#9662;" }),
]);
const pop = el("div", { class: "theme-popover hidden" });
sel.appendChild(btn); sel.appendChild(pop);
function render() {
applyTheme();
applyTheme(labelEl, swatchEl);
pop.innerHTML = `
<div class="theme-pop-header">Themes</div>
<div class="mode-row">