Skip to content

Latest commit

 

History

History
178 lines (144 loc) · 8.95 KB

STYLE.md

File metadata and controls

178 lines (144 loc) · 8.95 KB

RedNotes Plus style guide

How the app looks, feels and reads, so every part follows one style. It is for anyone who writes UI here, people and AI assistants alike (AGENTS.md imports it). When a pattern below does not fit, copy the closest existing component instead of inventing a new look, and add the new pattern here.

Principles

  • Stylus and touch first. The app is used with a pen in class. Every control must work with a pen, a finger and a mouse. Nothing may depend on hover, double-click or a right button alone.
  • Out of the way of the ink. UI floats above the canvas in compact bars and panels. It never sits where a right-handed palm rests (right edge, middle height) unless the user docks it there.
  • Quiet until needed. Neutral colours at rest; the primary colour marks what is selected or active, not decoration.
  • One way to do a thing. Reuse the components in lib/components/ and the class sets below rather than near-copies.

Colours

Tailwind v4 semantic tokens from app.css (@theme), derived from Catppuccin Mocha. Never hard-code a palette hex in a component.

Token Use
base-1 Panels, bars, popups, cards
base-2 Sections on a page, input fields, inset areas
base-3 The desk behind pages, wells (thumbnail backgrounds)
content-1 / -2 / -3 Text: main / secondary / hints and idle icons
overlay Hover backgrounds (hover:bg-overlay/30)
primary Selected, active, links, focus rings
info / success / warning / destructive Status only, with their -content text colours

Tints: bg-primary/15 for a selected or tagged item, bg-destructive/10 for a destructive hover. Borders are border-content-1/10; a stronger border-2 border-primary marks focus or an open control.

Type

  • font-display (Funnel Display) for dialog and page titles only; body text is Funnel Sans (the default).
  • Sizes: text-sm for most controls and lists, text-xs for meta lines and section labels, text-xl font-semibold for dashboard section headers, text-2xl/text-3xl font-display for overlay titles.
  • Small all-caps section labels: text-xs font-semibold uppercase tracking-wide text-content-3.
  • Numbers that change in place (zoom, timer, page numbers): tabular-nums.

Shape and spacing

  • Radius: rounded-xl for buttons, fields and sections; rounded-lg for small icon buttons and chips; rounded-2xl for floating bars, rounded-xl for their popovers; rounded-full for dots, badges and swatches.
  • Touch targets: 44 px (w-11 h-11) in the editor toolbar and view controls; at least 36 px (w-9 h-9) elsewhere; 32 px (h-8) only for chips and inline controls inside a larger target.
  • Gaps: gap-1 inside bars, gap-2/gap-3 between controls, gap-4 between sections; sections pad p-4.

Feedback

  • Every pressable element scales on press: active:scale-95 for wide buttons, active:scale-90 for icon buttons and swatches.
  • Add transition-all (or transition-colors) to anything that changes state.
  • Disabled: disabled:opacity-30 (toolbar) or opacity-45 cursor-not-allowed (forms, see Switch.svelte), and pointer-events-none where needed.
  • Results of an action: a toast via popupManager.add({ type, message }). Errors from Rust arrive as dialogs (show_error). Never alert().
  • A toast may offer one follow-up as action: { label, onClick } ("Reveal in folder"), drawn as a small primary-tinted button (h-8 px-2.5 rounded-lg bg-primary/15 text-primary text-xs font-semibold). Every toast also lands in the notification centre (bell in the tab bar).

Components and class sets

Use these as written (they appear in the files named).

Icon button (NoteCard.svelte, dashboard jot rows): w-9 h-9 grid place-items-center rounded-lg text-content-3 hover:text-content-1 hover:bg-overlay/30 active:scale-90 transition-all. In the editor the 44 px version (ViewControls.svelte btn): w-11 h-11 grid place-items-center rounded-xl text-content-2 hover:bg-overlay/30 hover:text-content-1 active:scale-90 transition-all. On/active: bg-primary text-base-1 (toolbar btnOn), or bg-primary/15 text-primary for a softer toggle.

Text button, secondary: h-10 px-3 rounded-xl text-content-2 hover:bg-overlay/30 hover:text-content-1 active:scale-95 transition-all. Primary: h-10 px-4 rounded-xl bg-primary text-base-1 font-semibold active:scale-95 transition-all. Destructive (secondary): swap the hover for hover:text-destructive hover:bg-destructive/10. A toggle that stays on (Jot Down's "Link page"): the secondary button with text-sm font-semibold, on = bg-primary/15 text-primary. No borders.

Chip (tags, a jot's due date or linked page; TagInput.svelte): flex items-center gap-1 h-8 pl-2.5 pr-1 rounded-lg bg-primary/15 text-primary text-sm font-semibold, with an inner × button w-6 h-6 grid place-items-center rounded-md hover:bg-primary/20. Tap the chip's label to open what it names; the × removes it. A warning state swaps primary for warning (an overdue date).

Field: h-11 px-3 rounded-xl bg-base-2 border-2 border-transparent focus-within:border-primary (or focus-within:ring-2 focus-within:ring-primary). Labels above fields: text-sm font-semibold text-content-2. Use Input.svelte, TagInput.svelte, DatePicker.svelte, Switch.svelte, Slider.svelte, ColorPicker.svelte before writing a new control.

Floating bar or popover (toolbar, view controls, ColorEditPopup): rounded-2xl bg-base-1/80 backdrop-blur-md shadow-lg border border-content-1/10 p-1.5. A popover from a bar: rounded-xl bg-base-1/85 backdrop-blur-md shadow-lg border border-content-1/10 p-3.

Dashboard section: flex flex-col gap-4 p-4 rounded-xl bg-base-2, header text-xl font-semibold with a Tabler icon.

Tab bar (Tabs.svelte, also the title bar): h-14 py-2, so every button in it, the window controls included, is 40 px tall; square icon buttons are aspect-square h-full rounded-xl border-2 border-content-1/10 bg-overlay/5. Nothing floats alone in it: with no tabs open, items move to the dashboard sidebar (the notification bell does).

Banner (update available, external notebook): full-width strip, shrink-0 flex items-center gap-3 px-3 py-1.5 bg-info/15 border-b border-info/30 text-sm, an icon, one sentence, and its action as h-8 px-3 rounded-lg font-semibold text-info hover:bg-info/20.

Overlay / dialog: Overlay.svelte (title, close button, scrolling body), opened through overlayManager (setOpen replaces, push stacks) so Escape closes it. Inside, controls that must not scroll away are shrink-0, or sticky at the top of the body.

Context menu: use:contextMenu (right-click, or a long press with pen or finger). It is the place for secondary and destructive actions; give a visible button (⋯) as well where an item has several.

Thumbnails: PageThumbnail.svelte (pass assets for a note that is not the open one); notebook previews in a bg-base-3 well with aspect-[1/1.41] or aspect-[3/4].

Interaction rules

  • Pen and touch: long press (about 350–500 ms) stands in for right-click. On Windows a pen's press-and-hold also fires contextmenu; treat that as the long press, not as a mouse right-click (holdReorder.svelte.ts shows how).
  • Reordering in place: hold, then drag (pen, finger) or drag (mouse); a hold released without moving opens the item's edit or menu. Use HoldReorder. Rows that a pen drags must be touch-none, with scrolling done in code.
  • No double-click as the only way to do anything.
  • UI over the canvas carries data-ui="true" when it is inside the use:canvasController element.
  • Keyboard: every overlay closes on Escape; shortcuts are listed in their buttons' title ("Save (Ctrl+S)").
  • Destructive actions go through a confirm dialog or are undoable; prefer undoable.

Icons

@tabler/icons-svelte only. Sizes: 20–24 in the editor bars, 18 for buttons in lists, 14–16 inside chips and small text. Idle icons are text-content-3; an icon beside text inherits its colour.

Words

  • Sentence case for labels and titles ("Save to library…", not "Save To Library").
  • An ellipsis (…) when the action opens a dialog before doing anything.
  • Plain, short and specific: say what happened and what to do ("The notebook could not be saved, so it stays in this window."). No "Oops", no exclamation marks except the "saved" toast.
  • British/American: follow the surrounding file; UI text so far says "colour".
  • title and aria-label on every icon-only button.

CSS

  • Tailwind classes in the markup. No <style> blocks in components (see the comment in app.css); shared CSS goes in app.css under @theme or @layer components.
  • Repeated class sets: a const in the component's script (as btn, chip), not a new global class, unless several components share it.
  • Dark paper, "Dark pages" and the light/dark theme are handled by the tokens and inkColor.ts; do not special-case colours per theme.