Dough Git

commit

Redesign the colors OwO

commit
2d617f4079d7b7b9b36d56b172a77620a853861a
author
Clove Twilight <[email protected]>
date
2026-09-04 17:34

diff --git a/.env.example b/.env.example
index 7c74ffb..0cbe5c2 100644
--- a/.env.example
+++ b/.env.example
@@ -29,7 +29,7 @@ MINIGIT_FAVICON=https://m.doughmination.gay/img/avatars/git.png
 MINIGIT_DESCRIPTION=A minimal self-hosted git mirror.
 
 # Browser UI colour on mobile (<meta name="theme-color">).
-MINIGIT_THEME_COLOR=#0a0b10
+MINIGIT_THEME_COLOR=#060d18
 
 # Filename that marks a bare repo public. Absent from the repo dir = private.
 # Public  = anyone may read, no login needed.
diff --git a/src/config.ts b/src/config.ts
index 9c6af33..08f891a 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -27,7 +27,7 @@ export const config = {
     "A minimal self-hosted git mirror.",
   ),
 
-  themeColor: optional("MINIGIT_THEME_COLOR", "#0a0b10"),
+  themeColor: optional("MINIGIT_THEME_COLOR", "#060d18"),
 
   publicMarker: optional("MINIGIT_PUBLIC_MARKER", "minigit-public"),
 
diff --git a/src/markdown.ts b/src/markdown.ts
index fef4b5b..f0e017c 100644
--- a/src/markdown.ts
+++ b/src/markdown.ts
@@ -56,8 +56,8 @@ const HTML_ATTRS: Record<string, readonly string[]> = {
   picture: [],
   source: ["src", "srcset", "media", "type"],
   div: ["align"],
-  p: ["align"],
-  span: [],
+  p: ["align", "pride"],
+  span: ["pride"],
   center: [],
   h1: ["align"],
   h2: ["align"],
@@ -112,6 +112,36 @@ const RAW_TEXT_INLINE = new RegExp(
   "gi",
 );
 
+const PRIDE_FLAGS = new Set([
+  "gay",
+  "lesbian",
+  "bisexual",
+  "transgender",
+  "pansexual",
+  "asexual",
+  "aromantic",
+  "nonbinary",
+  "queer",
+]);
+
+const PRIDE_ALIAS: Record<string, string> = {
+  trans: "transgender",
+  bi: "bisexual",
+  pan: "pansexual",
+  ace: "asexual",
+  aro: "aromantic",
+  enby: "nonbinary",
+  nb: "nonbinary",
+  mlm: "gay",
+  wlw: "lesbian",
+};
+
+function prideFlag(raw: string): string | null {
+  const key = raw.trim().toLowerCase();
+  const named = PRIDE_ALIAS[key] ?? key;
+  return PRIDE_FLAGS.has(named) ? named : null;
+}
+
 const ALIGN_VALUE = /^(?:left|center|right|justify)$/i;
 const DIMENSION_VALUE = /^\d{1,4}(?:%|px)?$/i;
 const COUNT_VALUE = /^\d{1,4}$/;
@@ -171,6 +201,8 @@ function attrValue(name: string, raw: string | undefined): string | null {
     case "alt":
     case "title":
       return raw ?? "";
+    case "pride":
+      return raw === undefined ? null : prideFlag(raw);
     case "open":
       return "";
     default:
@@ -186,6 +218,7 @@ function rebuildTag(closing: string, rawName: string, rawAttrs: string): string
 
   let out = `<${name}`;
   let href = "";
+  const seen = new Set<string>();
   HTML_ATTR.lastIndex = 0;
   let m: RegExpExecArray | null;
   while ((m = HTML_ATTR.exec(rawAttrs)) !== null) {
@@ -194,11 +227,13 @@ function rebuildTag(closing: string, rawName: string, rawAttrs: string): string
       continue;
     }
     const attr = m[1]!.toLowerCase();
-    if (!allowed.includes(attr)) continue;
+    if (!allowed.includes(attr) || seen.has(attr)) continue;
     const value = attrValue(attr, m[2] ?? m[3] ?? m[4]);
     if (value === null) continue;
+    seen.add(attr);
     if (attr === "href") href = value;
-    out += attr === "open" ? " open" : ` ${attr}="${value}"`;
+    if (attr === "pride") out += ` class="md-pride md-pride-${value}"`;
+    else out += attr === "open" ? " open" : ` ${attr}="${value}"`;
   }
 
   if (name === "a" && href) out += linkAttrs(href);
@@ -336,7 +371,7 @@ const FENCE = /^\s{0,3}(`{3,}|~{3,})\s*(\S*).*$/;
 const RULE = /^\s{0,3}([-*_])[ \t]*(?:\1[ \t]*){2,}$/;
 const QUOTE = /^\s{0,3}>/;
 
-const ALERT = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/i;
+const ALERT = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION|FROZEN|ASIDE)\]\s*$/i;
 
 const ALERT_ICON: Record<string, string> = {
   note: "info-box",
@@ -344,6 +379,8 @@ const ALERT_ICON: Record<string, string> = {
   important: "flag",
   warning: "warning-diamond",
   caution: "square-alert",
+  frozen: "snowflake",
+  aside: "wind",
 };
 
 function alertBlock(kind: string, body: string[], depth: number): string {
diff --git a/src/styles/app.css.ts b/src/styles/app.css.ts
index bb44118..6d271d2 100644
--- a/src/styles/app.css.ts
+++ b/src/styles/app.css.ts
@@ -132,6 +132,7 @@ export const classes = {
 
   profileName: style({
     fontFamily: vars.display,
+    color: vars.gilt,
     fontSize: "1.6rem",
     letterSpacing: "0.01em",
     margin: 0,
@@ -152,6 +153,7 @@ export const classes = {
 
   repoTitle: style({
     fontFamily: vars.display,
+    color: vars.gilt,
     fontSize: "1.55rem",
     fontWeight: 500,
     letterSpacing: "0.01em",
@@ -170,6 +172,7 @@ export const classes = {
 
   repoName: style({
     fontFamily: vars.display,
+    color: vars.gilt,
     fontSize: "1.05em",
     fontWeight: 500,
   }),
@@ -409,11 +412,25 @@ globalStyle(`${readme} blockquote`, {
 });
 
 const alertColor = {
-  note: "#4493f8",
-  tip: "#3fb950",
-  important: "#ab7df8",
-  warning: "#d29922",
-  caution: "#f85149",
+  note: "#47b6ee",
+  tip: "#96d94f",
+  important: "#b58fe0",
+  warning: "#f2b23c",
+  caution: "#ef6144",
+  frozen: "#b8dfe8",
+  aside: "#74c2a8",
+};
+
+const prideFlag: Record<string, string[]> = {
+  gay: ["#13a888", "#26ceaa", "#98e8c1", "#7bade2", "#918cdf"],
+  lesbian: ["#ec7151", "#e8782e", "#ee9d67", "#f2f7fb", "#d675af", "#ee63b5"],
+  bisexual: ["#ee64ab", "#bf80ba", "#6894ee"],
+  transgender: ["#67c9ee", "#f5a9b8", "#f2f7fb", "#f5a9b8", "#67c9ee"],
+  pansexual: ["#ee65a7", "#e6c619", "#37aae9"],
+  asexual: ["#8fa4bc", "#c3d3e2", "#f2f7fb", "#ec54ec"],
+  aromantic: ["#3fab44", "#a7d379", "#f2f7fb", "#c3d3e2", "#8fa4bc"],
+  nonbinary: ["#eae446", "#f2f7fb", "#b480dc", "#8fa4bc"],
+  queer: ["#ef6d6d", "#e68a19", "#e6d719", "#13ac41", "#7994dd", "#c578d5"],
 };
 
 globalStyle(`${readme} .md-alert`, {
@@ -446,6 +463,55 @@ for (const [kind, color] of Object.entries(alertColor)) {
   });
 }
 
+globalStyle(`${readme} .md-alert-frozen`, {
+  background: "rgba(184, 223, 232, 0.05)",
+});
+
+globalStyle(`${readme} .md-alert-aside`, {
+  borderLeftWidth: "2px",
+  color: vars.textMuted,
+});
+
+globalStyle(`${readme} .md-alert-aside .md-alert-title`, {
+  fontWeight: 400,
+});
+
+globalStyle(`${readme} .md-pride`, {
+  fontWeight: 600,
+  color: vars.text,
+  "@supports": {
+    "(-webkit-background-clip: text) or (background-clip: text)": {
+      WebkitBackgroundClip: "text",
+      backgroundClip: "text",
+      color: "transparent",
+      backgroundSize: "100% 100%",
+    },
+  },
+  "@media": {
+    "(prefers-contrast: more)": {
+      backgroundImage: "none",
+      color: vars.text,
+      WebkitTextFillColor: vars.text,
+    },
+  },
+});
+
+globalStyle(`${readme} .md-pride a`, {
+  color: "inherit",
+  textDecoration: "underline",
+});
+
+globalStyle(`${readme} .md-pride code`, {
+  WebkitTextFillColor: vars.textSoft,
+  color: vars.textSoft,
+});
+
+for (const [flag, stops] of Object.entries(prideFlag)) {
+  globalStyle(`${readme} .md-pride-${flag}`, {
+    backgroundImage: `linear-gradient(96deg, ${stops.join(", ")})`,
+  });
+}
+
 globalStyle(`${readme} ul, ${readme} ol`, {
   margin: "0.75rem 0",
   paddingLeft: "1.5rem",
diff --git a/src/styles/theme.css.ts b/src/styles/theme.css.ts
index 9f131bc..cb13c78 100644
--- a/src/styles/theme.css.ts
+++ b/src/styles/theme.css.ts
@@ -11,6 +11,7 @@ import {
 export const vars = createGlobalThemeContract({
   accent: "accent",
   accentAlt: "accent-alt",
+  gilt: "gilt",
   danger: "danger",
   success: "success",
 
@@ -34,23 +35,24 @@ export const vars = createGlobalThemeContract({
 });
 
 createGlobalTheme(":root", vars, {
-  accent: "#f5a9b8",
-  accentAlt: "#d15f8c",
-  danger: "#d15f8c",
-  success: "#f5a9b8",
-
-  bgDeep: "#05060a",
-  bgRaised: "#0e1017",
-  bg: "#0a0b10",
-  surface: "#12141c",
-  surfaceHi: "#1b1e2a",
-  border: "#232838",
-
-  textFaint: "#5b6480",
-  textDim: "#6b7391",
-  textMuted: "#9aa3c2",
-  textSoft: "#c9cfe0",
-  text: "#f4f6fb",
+  accent: "#5cd1e6",
+  accentAlt: "#34a9c6",
+  gilt: "#d8b775",
+  danger: "#ec6a80",
+  success: "#4fc9a4",
+
+  bgDeep: "#02060c",
+  bgRaised: "#0b1726",
+  bg: "#060d18",
+  surface: "#112035",
+  surfaceHi: "#1c2f48",
+  border: "#294464",
+
+  textFaint: "#64809c",
+  textDim: "#7a95b0",
+  textMuted: "#93aec7",
+  textSoft: "#c2d6e6",
+  text: "#eaf4fb",
 
   font: "'Comic Code', system-ui, -apple-system, sans-serif",
   display: "'Ink Free', 'Comic Code', system-ui, -apple-system, sans-serif",
diff --git a/test/markdown.test.mjs b/test/markdown.test.mjs
index 19068c2..33df0dc 100644
--- a/test/markdown.test.mjs
+++ b/test/markdown.test.mjs
@@ -362,5 +362,59 @@ check("closers cannot outnumber openers", has("<div>a</div></div></div>", "<div>
 check("the internal tag markers never reach output", lacks("<div>x</div>", "\u0001") && lacks("<div>x</div>", "\u0002"));
 check("a forged marker in source is inert", lacks("\u0001<script>alert(1)</script>\u0002", "<script"));
 
+console.log("\n-- seven elemental alerts --");
+
+for (const [kind, label] of [
+  ["NOTE", "Note"], ["TIP", "Tip"], ["IMPORTANT", "Important"],
+  ["WARNING", "Warning"], ["CAUTION", "Caution"],
+  ["FROZEN", "Frozen"], ["ASIDE", "Aside"],
+]) {
+  const md = `> [!${kind}]\n> body`;
+  check(`${kind} renders`, has(md, `md-alert-${kind.toLowerCase()}`) && has(md, `${label}</p>`));
+}
+check("alert kinds are case-insensitive", has("> [!frozen]\n> b", "md-alert-frozen"));
+check("an unknown alert stays a blockquote", has("> [!SPARKLE]\n> b", "<blockquote>"));
+check("alert body still renders markdown", has("> [!ASIDE]\n> **b**", "<strong>b</strong>"));
+
+console.log("\n-- pride text --");
+
+for (const flag of [
+  "gay", "lesbian", "bisexual", "transgender", "pansexual",
+  "asexual", "aromantic", "nonbinary", "queer",
+]) {
+  check(`pride="${flag}"`, has(`<p pride="${flag}">x</p>`, `<p class="md-pride md-pride-${flag}">x</p>`));
+}
+for (const [alias, real] of [
+  ["trans", "transgender"], ["bi", "bisexual"], ["pan", "pansexual"],
+  ["ace", "asexual"], ["aro", "aromantic"], ["enby", "nonbinary"],
+  ["nb", "nonbinary"], ["mlm", "gay"], ["wlw", "lesbian"],
+]) {
+  check(`alias "${alias}" resolves to ${real}`, has(`<p pride="${alias}">x</p>`, `md-pride-${real}`));
+}
+check("pride works on span, inline", has('a <span pride="queer">b</span> c', '<span class="md-pride md-pride-queer">b</span>'));
+check("markdown still renders inside", has('<p pride="gay">**b** and `c`</p>', "<strong>b</strong>"));
+check("code inside keeps its own colour hook", has('<p pride="gay">`c`</p>', "<code>c</code>"));
+check("styling stops at the closing tag", has('<p pride="gay">a</p>\n\nplain', "<p>plain</p>"));
+check("a neighbouring paragraph is untouched", lacks('<p pride="gay">a</p>\n\nplain', '<p class="md-pride md-pride-gay">plain'));
+
+console.log("\n-- pride fails closed --");
+
+check("an unknown flag renders a plain paragraph", has('<p pride="wibble">x</p>', "<p>x</p>"));
+check("an empty value renders plain", has('<p pride="">x</p>', "<p>x</p>"));
+check("two flags in one value render plain", has('<p pride="gay lesbian">x</p>', "<p>x</p>"));
+check("css cannot ride the attribute", lacks('<p pride="gay;background:url(javascript:1)">x</p>', "background"));
+check("markup cannot ride the attribute", lacks('<p pride="gay&quot;&gt;&lt;script&gt;">x</p>', "<script"));
+check("path characters are refused", has('<p pride="../../etc">x</p>', "<p>x</p>"));
+check("pride is not allowed on div", lacks('<div pride="gay">x</div>', "md-pride"));
+check("pride is not allowed on img", lacks('<img src="a.png" pride="gay">', "md-pride"));
+check(
+  "class cannot be set directly, so pride is the only route",
+  lacks('<p class="md-pride md-pride-gay">x</p>', "md-pride"),
+);
+check("a repeated pride attribute yields one class", (() => {
+  const out = renderMarkdown('<p pride="gay" pride="queer">x</p>');
+  return (out.match(/md-pride-/g) ?? []).length === 1;
+})());
+
 console.log(failures === 0 ? "\nALL PASSED" : `\n${failures} FAILED`);
 process.exit(failures === 0 ? 0 : 1);