Skip to content

Open source CapCut alternative.

TypeScript

fix(site): keep notes on their paper in dark mode

David Le784eab1a379f
diff --git a/.claude/skills/ui-quality/references/checks.md b/.claude/skills/ui-quality/references/checks.md
index d3cf49d8..c62da26b 100644
--- a/.claude/skills/ui-quality/references/checks.md
+++ b/.claude/skills/ui-quality/references/checks.md
@@ -8,7 +8,9 @@ The site theme lives in [globals.css](../../../../site/src/app/globals.css). `ba
The root uses the system preference until an explicit `.light` or `.dark` theme is set. Product `.app-surface` pages select `--app-background`, while public light pages use the sand background. Cold-load both kinds of surface. Check explicit light on a dark system and explicit dark on a light system when touching theme selection; exercise a preference change while the page is open.
-`ink`, `cream`, and `coral` are fixed brand colors. Pair fixed pastel cards with their intended ink. [Note paper](../../../../site/src/cut/components/notePaper.css) retains stored palette indices, uses muted card tints in dark mode, and adapts named text colors. Verify the sheet, tiles, and portaled menus.
+`ink`, `cream`, and `coral` are fixed brand colors. Pair fixed pastel cards with their intended ink. A `light` element and everything inside it keep the light tokens and skip `dark:` utilities. Note paper is one: the open note, its tiles, and its menus look the same in both themes.
+
+A dark-mode change leaves light mode pixel-identical. Keep the light value and add the dark one beside it, as in `text-[#454545] dark:text-foreground/70`.
Use [Button](../../../../site/src/components/ui/button.tsx), Input, Dialog, Popover, and DropdownMenu from the same UI directory. They carry focus, invalid, disabled, expanded, portal, and positioning behavior. Compose with `cn` and Tailwind responsive variants. Feature CSS belongs beside its owner; inline styles carry genuinely runtime values, such as data-derived CSS variables.
diff --git a/site/src/app/globals.css b/site/src/app/globals.css
index 5f1e11bf..fef6b7f6 100644
--- a/site/src/app/globals.css
+++ b/site/src/app/globals.css
@@ -4,11 +4,12 @@
@plugin "@tailwindcss/typography";
-/* Explicit themes and the system preference share the same utilities. */
+/* Explicit themes and the system preference share the same utilities. A
+ `.light` element and everything inside it stay light on a dark page. */
@custom-variant dark {
- &:where(.dark, .dark *) { @slot; }
+ &:where(.dark, .dark *):not(:where(.light, .light *)) { @slot; }
@media (prefers-color-scheme: dark) {
- &:where(:root:not(.light), :root:not(.light) *) { @slot; }
+ &:where(:root, :root *):not(:where(.light, .light *)) { @slot; }
}
}
@@ -48,7 +49,8 @@
--radius-4xl: calc(var(--radius) * 2.6);
}
-:root {
+:root,
+.light {
color-scheme: light;
--app-background: oklch(1 0 0);
--background: #F5EFE0;
@@ -139,6 +141,12 @@ html:has(.app-surface) {
--background: var(--app-background);
}
+/* A light element inside the app keeps the white product surface. Note paper
+ and its menus are light elements. */
+.light:not(:root) {
+ --background: var(--app-background);
+}
+
@layer base {
* {
@apply border-border outline-ring/50;
@@ -146,12 +154,6 @@ html:has(.app-surface) {
body {
@apply bg-background text-foreground;
}
- /* Form hints stay legible on the page's selected surface. */
- input::placeholder,
- textarea::placeholder {
- @apply text-muted-foreground;
- opacity: 1;
- }
h1,
h2,
h3,
diff --git a/site/src/cut/components/NoteBodyEditor.tsx b/site/src/cut/components/NoteBodyEditor.tsx
index 548850d2..cadb9cbc 100644
--- a/site/src/cut/components/NoteBodyEditor.tsx
+++ b/site/src/cut/components/NoteBodyEditor.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useEffect, useRef, useState, type ReactNode, type CSSProperties } from "react";
+import { useEffect, useRef, useState, type ReactNode } from "react";
import { EditorContent, useEditor, useEditorState, type Editor } from "@tiptap/react";
import { BubbleMenu } from "@tiptap/react/menus";
import StarterKit from "@tiptap/starter-kit";
@@ -142,7 +142,7 @@ export default function NoteBodyEditor({
"[&_li[data-checked=true]>div]:line-through [&_li[data-checked=true]>div]:opacity-50",
"[&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:cursor-pointer [&_input[type=checkbox]]:accent-current",
"[&_blockquote]:border-l-[3px] [&_blockquote]:border-current [&_blockquote]:pl-4",
- "[&_.is-editor-empty:first-child]:before:pointer-events-none [&_.is-editor-empty:first-child]:before:float-left [&_.is-editor-empty:first-child]:before:h-0 [&_.is-editor-empty:first-child]:before:opacity-70 [&_.is-editor-empty:first-child]:before:content-[attr(data-placeholder)]",
+ "[&_.is-editor-empty:first-child]:before:pointer-events-none [&_.is-editor-empty:first-child]:before:float-left [&_.is-editor-empty:first-child]:before:h-0 [&_.is-editor-empty:first-child]:before:opacity-40 [&_.is-editor-empty:first-child]:before:content-[attr(data-placeholder)]",
)}
style={{ color: ink }}
>
@@ -183,7 +183,7 @@ function Toolbar({ editor }: { editor: Editor }) {
<BubbleMenu
editor={editor}
options={{ placement: "top-start", offset: 8, onHide: () => setPanel(null) }}
- className="z-[60] flex items-center gap-0.5 rounded-lg border border-border bg-popover p-1 text-sm text-popover-foreground shadow-lg"
+ className="z-[60] flex items-center gap-0.5 rounded-lg border border-black/10 bg-white p-1 text-sm text-neutral-800 shadow-lg"
onMouseDown={keep}
>
<Menu
@@ -222,14 +222,14 @@ function Toolbar({ editor }: { editor: Editor }) {
open={panel === "color"}
onToggle={() => setPanel(panel === "color" ? null : "color")}
label="Text color"
- trigger={<><span className="font-semibold text-(--note-menu-color) dark:text-(--note-menu-color-dark)" style={{ "--note-menu-color": color?.paper, "--note-menu-color-dark": color?.dark } as CSSProperties}>A</span><ChevronDown className="size-3.5 opacity-50" /></>}
+ trigger={<><span className="font-semibold" style={{ color: color?.paper }}>A</span><ChevronDown className="size-3.5 opacity-50" /></>}
>
<MenuItem checked={!color} onPick={() => { editor.chain().focus().unsetMark("textColor").run(); setPanel(null); }}>
<span className="w-4 text-center font-semibold">A</span> Default
</MenuItem>
{NOTE_TEXT_COLORS.map((c) => (
<MenuItem key={c.id} checked={c.id === state.color} onPick={() => { editor.chain().focus().setMark("textColor", { color: c.id }).run(); setPanel(null); }}>
- <span className="w-4 text-center font-semibold text-(--note-menu-color) dark:text-(--note-menu-color-dark)" style={{ "--note-menu-color": c.paper, "--note-menu-color-dark": c.dark } as CSSProperties}>A</span> {c.name}
+ <span className="w-4 text-center font-semibold" style={{ color: c.paper }}>A</span> {c.name}
</MenuItem>
))}
</Menu>
@@ -237,7 +237,7 @@ function Toolbar({ editor }: { editor: Editor }) {
);
}
-const Divider = () => <div className="mx-0.5 h-5 w-px bg-foreground/10" />;
+const Divider = () => <div className="mx-0.5 h-5 w-px bg-black/10" />;
function Toggle({ label, on, onPress, children }: { label: string; on: boolean; onPress: () => void; children: ReactNode }) {
return (
@@ -245,7 +245,7 @@ function Toggle({ label, on, onPress, children }: { label: string; on: boolean;
type="button"
aria-label={label}
aria-pressed={on}
- className={cn("grid size-7 cursor-pointer place-items-center rounded-md hover:bg-foreground/5", on && "bg-foreground/10 hover:bg-foreground/10")}
+ className={cn("grid size-7 cursor-pointer place-items-center rounded-md hover:bg-black/5", on && "bg-black/10 hover:bg-black/10")}
onClick={onPress}
>
{children}
@@ -263,13 +263,13 @@ function Menu({ open, onToggle, label, trigger, fit = "label", children }: { ope
type="button"
aria-label={label}
aria-expanded={open}
- className={cn("flex h-7 cursor-pointer items-center gap-1 rounded-md hover:bg-foreground/5", fit === "icon" ? "px-1" : "px-2", open && "bg-foreground/5")}
+ className={cn("flex h-7 cursor-pointer items-center gap-1 rounded-md hover:bg-black/5", fit === "icon" ? "px-1" : "px-2", open && "bg-black/5")}
onClick={onToggle}
>
{trigger}
</button>
{open && (
- <div role="menu" className="absolute top-full left-0 mt-1.5 w-44 rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-lg">
+ <div role="menu" className="absolute top-full left-0 mt-1.5 w-44 rounded-lg border border-black/10 bg-white p-1 shadow-lg">
{children}
</div>
)}
@@ -283,7 +283,7 @@ function MenuItem({ checked, onPick, children }: { checked: boolean; onPick: ()
type="button"
role="menuitemradio"
aria-checked={checked}
- className="flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-foreground/5"
+ className="flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-black/5"
onClick={onPick}
>
<span className="flex min-w-0 flex-1 items-center gap-2">{children}</span>
diff --git a/site/src/cut/components/NoteBodyPreview.tsx b/site/src/cut/components/NoteBodyPreview.tsx
index dbb933a5..5f977ff9 100644
--- a/site/src/cut/components/NoteBodyPreview.tsx
+++ b/site/src/cut/components/NoteBodyPreview.tsx
@@ -1,4 +1,4 @@
-import { Fragment, type CSSProperties } from "react";
+import { Fragment } from "react";
import { NOTE_TEXT_COLORS, parseNoteBody, type NoteBlock, type NoteRun } from "@/cut/lib/noteMarkdown";
import { cn } from "@/lib/utils";
@@ -38,7 +38,7 @@ export function NoteBodyPreview({ body, lines, className }: { body: string; line
function Runs({ block }: { block: NoteBlock }) {
return block.runs.map((r: NoteRun, i) => {
- const color = r.marks.color ? NOTE_TEXT_COLORS.find((c) => c.id === r.marks.color) : undefined;
+ const color = r.marks.color ? NOTE_TEXT_COLORS.find((c) => c.id === r.marks.color)?.paper : undefined;
const styled = r.marks.bold || r.marks.italic || r.marks.underline || r.marks.strike || color;
if (!styled) return <Fragment key={i}>{r.text}</Fragment>;
return (
@@ -49,8 +49,7 @@ function Runs({ block }: { block: NoteBlock }) {
r.marks.italic && "italic",
r.marks.underline && r.marks.strike ? "[text-decoration-line:underline_line-through]" : r.marks.underline ? "underline" : r.marks.strike && "line-through",
)}
- data-color={color?.id}
- style={color ? { color: `var(--note-text-ink, ${color.paper})`, "--note-text-paper": color.paper, "--note-text-dark": color.dark } as CSSProperties : undefined}
+ style={color ? { color } : undefined}
>
{r.text}
</span>
diff --git a/site/src/cut/components/NoteComposer.tsx b/site/src/cut/components/NoteComposer.tsx
index e1f8d96a..217cd24d 100644
--- a/site/src/cut/components/NoteComposer.tsx
+++ b/site/src/cut/components/NoteComposer.tsx
@@ -19,7 +19,8 @@ import { NOTE_COLORS, noteColor, type CutNoteLabel } from "@/cut/lib/notes";
import { NOTE_LABELS_MAX } from "@/cut/lib/types";
import { cn } from "@/lib/utils";
-import "./notePaper.css";
+// The note paper's ink, matching the iOS app.
+const NOTE_INK = "#201a0d";
// The rich text editor loads with the first note opened, off the list's own
// bundle.
@@ -199,13 +200,18 @@ export function NoteComposer({
aria-modal="true"
aria-label={draft.title.trim() || "Untitled note"}
{...KEEP_EVENTS}
- className="note-paper fixed inset-0 z-50 flex flex-col font-system antialiased"
- style={{ "--note-paper-background": paper.background, "--note-accent": paper.accent } as React.CSSProperties}
+ // `light` keeps the paper, its controls and its menus light in dark mode.
+ className="light fixed inset-0 z-50 flex flex-col font-system antialiased"
+ style={{ backgroundColor: paper.background, color: NOTE_INK }}
>
- <header className="flex shrink-0 items-center gap-2 px-6 py-3">
+ <header
+ className="flex shrink-0 items-center gap-2 px-6 py-3"
+ style={{ backgroundColor: paper.background }}
+ >
<Button
variant="ghost"
- className="hover:bg-black/5 hover:text-current dark:hover:bg-white/5"
+ className="hover:bg-black/5 hover:text-current"
+ style={{ color: NOTE_INK }}
onClick={onClose}
>
<ArrowLeft data-icon="inline-start" />{" "}
@@ -218,7 +224,8 @@ export function NoteComposer({
<Button
variant="ghost"
aria-label="Note color"
- className="hover:bg-black/5 hover:text-current dark:hover:bg-white/5"
+ className="hover:bg-black/5 hover:text-current"
+ style={{ color: NOTE_INK }}
/>
}
>
@@ -229,7 +236,7 @@ export function NoteComposer({
{paper.name}
<ChevronDown className="size-3.5 opacity-60" />
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-40">
+ <DropdownMenuContent align="end" className="light w-40">
{NOTE_COLORS.map((c, i) => (
<DropdownMenuItem
key={c.name}
@@ -249,7 +256,7 @@ export function NoteComposer({
<Button
variant="ghost"
aria-label="Delete note"
- className="text-destructive hover:bg-black/5 hover:text-destructive dark:hover:bg-white/5"
+ className="text-destructive hover:bg-black/5 hover:text-destructive"
onClick={onDelete}
>
<Trash2 data-icon="inline-start" /> Delete
@@ -267,7 +274,8 @@ export function NoteComposer({
rows={1}
value={draft.title}
placeholder="Untitled"
- className="resize-none overflow-hidden bg-transparent text-4xl leading-tight font-semibold tracking-tight outline-none placeholder:text-current placeholder:opacity-60"
+ className="resize-none overflow-hidden bg-transparent text-4xl leading-tight font-semibold tracking-tight outline-none placeholder:opacity-30"
+ style={{ color: NOTE_INK }}
onChange={(e) => onChange({ ...draft, title: e.target.value.replace(/\n/g, "") })}
onKeyDown={(e) => {
if (e.key === "Enter") {
@@ -282,7 +290,7 @@ export function NoteComposer({
{worn.map((l) => (
<button
key={l.id}
- className="group flex cursor-pointer items-center gap-1 rounded-full bg-black/10 px-2.5 py-1 text-xs font-medium hover:bg-black/15 dark:bg-white/10 dark:hover:bg-white/15"
+ className="group flex cursor-pointer items-center gap-1 rounded-full bg-black/10 px-2.5 py-1 text-xs font-medium hover:bg-black/15"
aria-label={`Remove label ${l.name}`}
onClick={() => toggleLabel(l.id)}
>
@@ -294,7 +302,7 @@ export function NoteComposer({
<PopoverTrigger
render={
<button
- className="flex cursor-pointer items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium opacity-70 hover:bg-black/10 hover:opacity-80 dark:hover:bg-white/10"
+ className="flex cursor-pointer items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium opacity-50 hover:bg-black/10 hover:opacity-80"
aria-label="Add label"
/>
}
@@ -302,7 +310,7 @@ export function NoteComposer({
{worn.length === 0 ? <Tag className="size-3.5" /> : <Plus className="size-3.5" />}
{worn.length === 0 ? "Add label" : "Label"}
</PopoverTrigger>
- <PopoverContent align="start" className="w-64">
+ <PopoverContent align="start" className="light w-64">
<LabelPicker
labels={labels}
selected={draft.labelIds}
@@ -316,7 +324,7 @@ export function NoteComposer({
</div>
<NoteBodyEditor
body={draft.body}
- ink="currentColor"
+ ink={NOTE_INK}
onChange={(text) => onChange({ ...draftRef.current, body: text })}
onEditor={(editor) => (body.current = editor)}
/>
diff --git a/site/src/cut/components/NotesView.tsx b/site/src/cut/components/NotesView.tsx
index dbbc160a..d1f0e93c 100644
--- a/site/src/cut/components/NotesView.tsx
+++ b/site/src/cut/components/NotesView.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useEffect, useImperativeHandle, useRef, useState, type Ref, type CSSProperties } from "react";
+import { useEffect, useImperativeHandle, useRef, useState, type Ref } from "react";
import { useSearchParams } from "next/navigation";
import { useQueryClient, type QueryClient } from "@tanstack/react-query";
import { FolderPlus, Loader2, Plus, StickyNote, Trash2 } from "lucide-react";
@@ -39,7 +39,8 @@ import { LIBRARY_SQUARE } from "./LibraryCard";
import { NoteComposer, noteChanged, type NoteDraft } from "./NoteComposer";
import { NoteBodyPreview } from "./NoteBodyPreview";
-import "./notePaper.css";
+// The note paper's ink, matching the iOS app.
+const NOTE_INK = "#201a0d";
// A dragged selection of notes, the same shape the library and the projects
// home carry: a JSON array of ids under this page's own MIME type.
@@ -742,17 +743,18 @@ export function NotesView({ library, ref }: Props = {}) {
onDragStart={(e) => onCardDragStart(e, n.id)}
onDragEnd={clearRefDrag}
className={cn(
- "note-paper flex cursor-pointer flex-col gap-1.5 text-left shadow-sm",
+ // Paper stays light in dark mode, like the open note.
+ "light flex cursor-pointer flex-col gap-1.5 text-left shadow-sm",
// A note is a file like the rest: the same square a sound
// tile is, here and in the Library.
"overflow-hidden rounded-xl p-3",
)}
style={{
- "--note-paper-background": noteColor(n.colorIndex).background,
- "--note-accent": noteColor(n.colorIndex).accent,
+ backgroundColor: noteColor(n.colorIndex).background,
+ color: NOTE_INK,
width: LIBRARY_SQUARE,
height: LIBRARY_SQUARE,
- } as CSSProperties}
+ }}
onClick={(e) => {
if (!additiveClick(e)) {
openNote(n);
@@ -764,13 +766,13 @@ export function NotesView({ library, ref }: Props = {}) {
>
{/* Clear of the actions button that takes the corner on hover. */}
{n.title && <div className="truncate pr-6 text-[13px] font-semibold">{n.title}</div>}
- <NoteBodyPreview body={n.body} lines={5} className="text-[12px] opacity-80 dark:opacity-100" />
+ <NoteBodyPreview body={n.body} lines={5} className="text-[12px] opacity-80" />
{worn.length > 0 && (
<div className="mt-auto flex flex-wrap gap-1 pt-1.5">
{worn.map((name) => (
<span
key={name}
- className="rounded-full bg-black/10 px-2 py-0.5 text-[11px] font-medium dark:bg-white/10"
+ className="rounded-full bg-black/10 px-2 py-0.5 text-[11px] font-medium"
>
{name}
</span>
diff --git a/site/src/cut/components/notePaper.css b/site/src/cut/components/notePaper.css
deleted file mode 100644
index 84208d2a..00000000
--- a/site/src/cut/components/notePaper.css
+++ /dev/null
@@ -1,22 +0,0 @@
-@reference "../../app/globals.css";
-
-/* Stored paper colors stay shared with iOS; dark paper keeps a quiet tint. */
-.note-paper {
- background-color: var(--note-paper-background);
- color: #201a0d;
-}
-
-.note-paper [data-color] {
- --note-text-ink: var(--note-text-paper);
-}
-
-@variant dark {
- .note-paper {
- background-color: color-mix(in srgb, var(--card) 94%, var(--note-accent) 6%);
- color: var(--card-foreground);
- }
-
- .note-paper [data-color] {
- --note-text-ink: color-mix(in srgb, var(--note-text-dark) 75%, white 25%);
- }
-}
diff --git a/site/src/cut/components/notePaper.test.tsx b/site/src/cut/components/notePaper.test.tsx
index 6c63e2ec..89d14d06 100644
--- a/site/src/cut/components/notePaper.test.tsx
+++ b/site/src/cut/components/notePaper.test.tsx
@@ -1,17 +1,11 @@
import { expect, test } from "bun:test";
import { readFileSync } from "node:fs";
import postcss from "postcss";
-import { renderToStaticMarkup } from "react-dom/server";
-import { parseHTML } from "linkedom";
-import { DOMSerializer } from "@tiptap/pm/model";
-import { getSchema } from "@tiptap/core";
-import StarterKit from "@tiptap/starter-kit";
import { NOTE_COLORS, noteColor } from "@/cut/lib/notes";
-import { NOTE_TEXT_COLORS, parseNoteBody } from "@/cut/lib/noteMarkdown";
-import { docOf, TextColor } from "@/cut/lib/noteDoc";
-import { NoteBodyPreview } from "./NoteBodyPreview";
-// Saved palette indices keep their paper colors while CSS adapts the surface.
+const css = postcss.parse(readFileSync(new URL("../../app/globals.css", import.meta.url), "utf8"));
+
+// Saved palette indices keep the paper colors shared with iOS.
test("note palette indices retain the shared iOS colors", () => {
expect(NOTE_COLORS.map((c) => [c.name, c.background])).toEqual([
["Butter", "#faefb6"], ["Blush", "#fbd8d4"], ["Sky", "#d5e8fb"],
@@ -21,34 +15,29 @@ test("note palette indices retain the shared iOS colors", () => {
expect(noteColor(5)).toBe(NOTE_COLORS[0]);
});
-test("dark note paper pairs a muted card tint with its foreground", () => {
- const css = postcss.parse(readFileSync(new URL("./notePaper.css", import.meta.url), "utf8"));
- const dark = new Map<string, string>();
- css.walkAtRules("variant", (rule) => {
- if (rule.params === "dark") {
- rule.walkDecls((decl) => { dark.set(decl.prop, decl.value); });
+// Notes keep their paper in dark mode: the paper, its tiles and its menus are
+// `.light` elements, which carry the light tokens on a dark page.
+test("a light element keeps the light tokens", () => {
+ const tokens = new Map<string, string>();
+ css.walkRules((rule) => {
+ if (rule.selectors.includes(".light")) {
+ rule.walkDecls((decl) => { tokens.set(decl.prop, decl.value); });
}
});
- expect(dark.get("background-color")).toBe("color-mix(in srgb, var(--card) 94%, var(--note-accent) 6%)");
- expect(dark.get("color")).toBe("var(--card-foreground)");
- expect(dark.get("--note-text-ink")).toBe("color-mix(in srgb, var(--note-text-dark) 75%, white 25%)");
+ expect(tokens.get("color-scheme")).toBe("light");
+ expect(tokens.get("--foreground")).toBe("oklch(0.145 0 0)");
+ expect(tokens.get("--card")).toBe("oklch(1 0 0)");
+ expect(tokens.get("--popover")).toBe("oklch(1 0 0)");
});
-test("editor and tile text colors retain named marks and theme palettes", () => {
- const schema = getSchema([StarterKit.configure({ link: false }), TextColor]);
- const serializer = DOMSerializer.fromSchema(schema);
- for (const color of NOTE_TEXT_COLORS) {
- const body = `<span color="${color.id}">Readable color</span>`;
- const { document } = parseHTML("<html><body></body></html>");
- const node = schema.nodeFromJSON(docOf(parseNoteBody(body)));
- const container = document.createElement("div");
- container.appendChild(serializer.serializeFragment(node.content, { document }));
- const preview = parseHTML(renderToStaticMarkup(<NoteBodyPreview body={body} lines={2} />)).document;
- for (const span of [container.querySelector("[data-color]"), preview.querySelector("[data-color]")]) {
- expect(span?.getAttribute("data-color")).toBe(color.id);
- expect(span?.getAttribute("style")).toContain("var(--note-text-ink,");
- expect(span?.getAttribute("style")).toContain(color.paper);
- expect(span?.getAttribute("style")).toContain(color.dark);
+// Dark utilities skip a light element and everything inside it, for both the
+// explicit `.dark` theme and the system preference.
+test("dark utilities skip light elements", () => {
+ let variant = "";
+ css.walkAtRules("custom-variant", (rule) => {
+ if (rule.params === "dark") {
+ variant = rule.toString();
}
- }
+ });
+ expect(variant.match(/:not\(:where\(\.light, \.light \*\)\)/g)?.length).toBe(2);
});
diff --git a/site/src/cut/lib/noteDoc.ts b/site/src/cut/lib/noteDoc.ts
index 7d0a462c..fbde0a82 100644
--- a/site/src/cut/lib/noteDoc.ts
+++ b/site/src/cut/lib/noteDoc.ts
@@ -198,7 +198,8 @@ function cutLine(tr: Transaction, pos: number): number | null {
return base + before;
}
-/** A named text color. The stored name carries paper and dark display inks. */
+/** A named text color. The name is what the body stores; the ink is the
+ * paper's. */
export const TextColor = Mark.create({
name: "textColor",
addAttributes() {
@@ -206,13 +207,10 @@ export const TextColor = Mark.create({
color: {
default: null,
parseHTML: (el) => el.getAttribute("data-color"),
- renderHTML: (attrs) => {
- const color = NOTE_TEXT_COLORS.find((c) => c.id === attrs.color);
- return {
- "data-color": attrs.color,
- style: color ? `color: var(--note-text-ink, ${color.paper}); --note-text-paper: ${color.paper}; --note-text-dark: ${color.dark}` : undefined,
- };
- },
+ renderHTML: (attrs) => ({
+ "data-color": attrs.color,
+ style: `color: ${NOTE_TEXT_COLORS.find((c) => c.id === attrs.color)?.paper ?? "inherit"}`,
+ }),
},
};
},