From be320c08fe8d836eb9e1b909d02ab736346277e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 20 Aug 2026 09:12:19 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(ui):=20the=20darkroom=20tokens?= =?UTF-8?q?=20and=20the=20cut=20chords=20land?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DESIGN.md §12 steps 1 and 3a. theme.rs gains a thirteenth palette family, Darkroom, plus the fifteen roles the design contract names: the four-level ink ladder, the dark surface set, the lamp white, the three notice spines and the safelight pair. The twelve legacy families alias the new roles onto their nearest existing one so the palette macro still compiles for all of them. keymap.rs gains a shift field on Chord and the cut-machinery actions: , and . walk cuts (shift strides ten), bare [ and ] trim the subject cut, / loop-trims. SelectPrev/SelectNext move to shift+[ and shift+] to hand the bare brackets to trim as DESIGN.md §6 requires; every surface reads those labels live, so no stale chord text remains. The oracle refuses all five with "no subject cut" until one exists. Dispatch stays a no-op arm — a later step wires the behaviour. --- crates/app/src/keymap.rs | 176 ++++++++++++++---- crates/app/src/oracle.rs | 13 ++ crates/app/src/player/actions.rs | 8 + crates/app/src/tests/view.rs | 1 + crates/app/src/ui/overlays.rs | 1 + crates/app/src/ui/theme.rs | 303 ++++++++++++++++++++++++++++++- 6 files changed, 468 insertions(+), 34 deletions(-) diff --git a/crates/app/src/keymap.rs b/crates/app/src/keymap.rs index 3adc6ce..a24331a 100644 --- a/crates/app/src/keymap.rs +++ b/crates/app/src/keymap.rs @@ -80,6 +80,11 @@ actions! { /// by what they are for. PrevSyncPoint, NextSyncPoint, + /// Walks to the next cut (DESIGN.md §6): the odometer the cut readout + /// counts against. Shift strides ten cuts instead of one. + WalkCutNext, + /// The pair's other half, one cut earlier. Shift strides ten. + WalkCutPrev, /// Marks the playhead as an export's in point. The out point wraps around /// it if the mark lands past the current out ([`ordered_range`]). SetIn, @@ -138,6 +143,17 @@ actions! { /// two adjacent clips picked on one lane, or a single pick faded into the /// clip right after it. Crossfade, + /// No-aim trim of the subject cut's in point, frame detents, at any zoom + /// (DESIGN.md §6), on its designed bare `[`. [`ActionId::SelectPrev`] + /// moved to shift+[ to free it -- see keymap.rs's own defaults. + TrimIn, + /// The pair's other half, the subject cut's out point, on its designed + /// bare `]` -- [`ActionId::SelectNext`] moved to shift+] for the same + /// reason. + TrimOut, + /// Loop-trim: loops around the subject cut while trimming it (DESIGN.md + /// §6, "the modernized Avid trim mode"). + LoopTrim, /// Dissolves the selected video clip into its neighbour /// ([`Project::set_transition_out`]): two adjacent clips picked on one /// lane, or a single pick dissolved into the clip right after it. A @@ -192,6 +208,8 @@ impl ActionId { ActionId::GoEnd => "Go to the last frame", ActionId::PrevSyncPoint => "Previous sync point (a cut here is copied, not re-encoded)", ActionId::NextSyncPoint => "Next sync point (a cut here is copied, not re-encoded)", + ActionId::WalkCutNext => "Walk to the next cut (shift: ten cuts)", + ActionId::WalkCutPrev => "Walk to the previous cut (shift: ten cuts)", ActionId::SetIn => "Mark in (export range)", ActionId::SetOut => "Mark out (export range)", ActionId::ClearRange => "Clear the export range", @@ -235,6 +253,9 @@ impl ActionId { ActionId::Speed => "Speed (tape)…", ActionId::Silence => "Silences: cut or speed up…", ActionId::Crossfade => "Crossfade into the next clip", + ActionId::TrimIn => "Trim the subject cut's in point", + ActionId::TrimOut => "Trim the subject cut's out point", + ActionId::LoopTrim => "Loop-trim the subject cut", ActionId::Dissolve => "Dissolve into the next clip", ActionId::Mix => "Mix: track volumes and the limiter…", ActionId::ToggleSnap => "Snap on / off (edges, the playhead, the start)", @@ -264,6 +285,8 @@ impl ActionId { ActionId::GoEnd => "go-end", ActionId::PrevSyncPoint => "prev-sync-point", ActionId::NextSyncPoint => "next-sync-point", + ActionId::WalkCutNext => "walk-cut-next", + ActionId::WalkCutPrev => "walk-cut-prev", ActionId::SetIn => "set-in", ActionId::SetOut => "set-out", ActionId::ClearRange => "clear-range", @@ -304,6 +327,9 @@ impl ActionId { ActionId::Speed => "speed", ActionId::Silence => "silence", ActionId::Crossfade => "crossfade", + ActionId::TrimIn => "trim-in", + ActionId::TrimOut => "trim-out", + ActionId::LoopTrim => "loop-trim", ActionId::Dissolve => "dissolve", ActionId::Mix => "mix", ActionId::ToggleSnap => "toggle-snap", @@ -338,6 +364,8 @@ impl ActionId { | ActionId::GoEnd | ActionId::PrevSyncPoint | ActionId::NextSyncPoint + | ActionId::WalkCutNext + | ActionId::WalkCutPrev | ActionId::SetIn | ActionId::SetOut | ActionId::ClearRange => Category::Playback, @@ -361,6 +389,9 @@ impl ActionId { // above it, opened on whichever half was picked. | ActionId::Silence | ActionId::Crossfade + | ActionId::TrimIn + | ActionId::TrimOut + | ActionId::LoopTrim | ActionId::Dissolve => Category::Clips, // The project's own picture size is not a clip's business, and not // a file operation either: it is what the viewer is looking at. @@ -765,23 +796,27 @@ pub static FIXED: std::sync::LazyLock<[Fixed; 35]> = std::sync::LazyLock::new(|| ] }); -/// A stroke as the key handler sees it: gpui's key name plus the one modifier -/// this editor binds. Nothing else is a chord here -- shift and alt are part of -/// the key name gpui reports, and a second modifier would need the file format -/// to grow before it could be spelled. +/// A stroke as the key handler sees it: gpui's key name plus the two +/// modifiers this editor binds. Nothing else is a chord here -- alt is part +/// of the key name gpui reports, and a third modifier would need the file +/// format to grow before it could be spelled. #[derive(Clone, PartialEq, Eq, Debug)] pub struct Chord { pub key: String, pub ctrl: bool, + pub shift: bool, } impl Chord { - /// The file's spelling, and the only one [`parse`] accepts back. + /// The file's spelling, and the only one [`parse`] accepts back. Ctrl + /// always comes before shift, so a chord round-trips through one spelling + /// and not two. fn text(&self) -> String { - if self.ctrl { - format!("ctrl+{}", self.key) - } else { - self.key.clone() + match (self.ctrl, self.shift) { + (true, true) => format!("ctrl+shift+{}", self.key), + (true, false) => format!("ctrl+{}", self.key), + (false, true) => format!("shift+{}", self.key), + (false, false) => self.key.clone(), } } @@ -795,10 +830,11 @@ impl Chord { } else { &self.key }; - if self.ctrl { - format!("ctrl+{key}") - } else { - key.to_string() + match (self.ctrl, self.shift) { + (true, true) => format!("ctrl+shift+{key}"), + (true, false) => format!("ctrl+{key}"), + (false, true) => format!("shift+{key}"), + (false, false) => key.to_string(), } } @@ -812,15 +848,19 @@ impl Chord { Chord::parse(&self.text(), 0).is_ok_and(|round_trip| round_trip == *self) } - /// Strict: exactly one optional `ctrl+` and then a key gpui could have - /// reported. A spelling this cannot emit back unchanged is refused rather - /// than normalised, because the round-trip is what makes the file editable - /// by hand at all. + /// Strict: exactly one optional `ctrl+`, then one optional `shift+`, then + /// a key gpui could have reported. A spelling this cannot emit back + /// unchanged is refused rather than normalised, because the round-trip is + /// what makes the file editable by hand at all. fn parse(text: &str, n: usize) -> Result { - let (ctrl, key) = match text.strip_prefix("ctrl+") { - Some(key) => (true, key), + let (ctrl, rest) = match text.strip_prefix("ctrl+") { + Some(rest) => (true, rest), None => (false, text), }; + let (shift, key) = match rest.strip_prefix("shift+") { + Some(key) => (true, key), + None => (false, rest), + }; if key.is_empty() || key.contains(' ') || key.contains('+') @@ -831,6 +871,7 @@ impl Chord { Ok(Chord { key: key.to_string(), ctrl, + shift, }) } } @@ -860,6 +901,15 @@ impl Keymap { chord: Chord { key: key.to_string(), ctrl, + shift: false, + }, + }; + let bshift = |action, key: &str| Binding { + action, + chord: Chord { + key: key.to_string(), + ctrl: false, + shift: true, }, }; Keymap { @@ -887,6 +937,12 @@ impl Keymap { // step through the same timeline by the source's own grid. b(ActionId::PrevSyncPoint, "[", true), b(ActionId::NextSyncPoint, "]", true), + // The cut odometer (DESIGN.md §6): bare walks one cut, shift + // strides ten. Both were free. + b(ActionId::WalkCutNext, ".", false), + bshift(ActionId::WalkCutNext, "."), + b(ActionId::WalkCutPrev, ",", false), + bshift(ActionId::WalkCutPrev, ","), // The mark pair, on the letters every editor already means them // by: bare, since a mark is set as often as a step and nothing // else in this table answers to either. @@ -915,10 +971,13 @@ impl Keymap { // means by "move on to the next thing", and the two brackets // are the pair either side of it in the lane -- shift+tab is // the obvious partner and is unspellable here, since a chord - // carries only ctrl and `parse` refuses an uppercase key. + // carries only ctrl and `parse` refuses an uppercase key. Bare + // brackets are DESIGN.md §6's own trim pair now, so selection + // takes the shifted chord: same two keys, the modifier telling + // "walk the lane" apart from "trim the cut". b(ActionId::Select, "tab", false), - b(ActionId::SelectNext, "]", false), - b(ActionId::SelectPrev, "[", false), + bshift(ActionId::SelectNext, "]"), + bshift(ActionId::SelectPrev, "["), // Select-all, on the chord every editor and every text field // already means it by -- which is why the audio-lane removal // below had to move off ctrl+a: a stroke that universal was @@ -1004,6 +1063,16 @@ impl Keymap { // ctrl its own room now that plain "f" is the mix card's own // (below) -- the same letter, the modifier telling them apart. b(ActionId::Crossfade, "f", true), + // DESIGN.md §6's own chords: bare `[` `]` are the no-aim trim + // pair. SelectPrev/SelectNext moved to shift+[ shift+] above + // to make room -- the bare bracket trims the subject cut, + // the shifted one walks the selection past it, so the family + // reads as one idea under one pair of keys. + b(ActionId::TrimIn, "[", false), + b(ActionId::TrimOut, "]", false), + // Loop-trim (DESIGN.md §6, "the modernized Avid trim mode"): + // bare "/" was free. + b(ActionId::LoopTrim, "/", false), // Dissolve takes ctrl+x: the join it draws on the timeline is // an X (widgets.rs, dissolve_glyph) -- "d" itself is taken // both plain (Detach) and, in the keymap's own rebind test, @@ -1066,9 +1135,18 @@ impl Keymap { /// What a stroke means, if anything. `key` is gpui's key name and `ctrl` its /// control modifier -- the pair the key handler already matches on. pub fn lookup(&self, key: &str, ctrl: bool) -> Option { + self.lookup_shifted(key, ctrl, false) + } + + /// [`Keymap::lookup`] plus the shift modifier, for a stroke like + /// `shift+.` (the cut odometer's stride-ten). The key handler does not + /// pass shift yet -- that is the dispatch task's wiring, not this one's -- + /// so every current caller goes through the two-argument [`Keymap::lookup`] + /// above and only ever reaches an unshifted chord. + pub fn lookup_shifted(&self, key: &str, ctrl: bool, shift: bool) -> Option { self.bindings .iter() - .find(|b| b.chord.ctrl == ctrl && b.chord.key == key) + .find(|b| b.chord.ctrl == ctrl && b.chord.shift == shift && b.chord.key == key) .map(|b| b.action) } @@ -1308,6 +1386,7 @@ mod tests { Chord { key: key.to_string(), ctrl, + shift: false, } } @@ -1322,7 +1401,22 @@ mod tests { #[test] fn every_default_stroke_reaches_its_action() { let k = Keymap::defaults(); - assert_eq!(k.entries().len(), 64); + assert_eq!(k.entries().len(), 71); + // The cut odometer: bare walks one, shift strides ten. + assert_eq!(k.lookup(".", false), Some(ActionId::WalkCutNext)); + assert_eq!(k.lookup(",", false), Some(ActionId::WalkCutPrev)); + assert_eq!(k.lookup("/", false), Some(ActionId::LoopTrim)); + assert_eq!( + k.lookup_shifted(".", false, true), + Some(ActionId::WalkCutNext) + ); + assert_eq!( + k.lookup_shifted(",", false, true), + Some(ActionId::WalkCutPrev) + ); + // The trim pair, on its designed bare brackets (DESIGN.md §6). + assert_eq!(k.lookup("[", false), Some(ActionId::TrimIn)); + assert_eq!(k.lookup("]", false), Some(ActionId::TrimOut)); assert_eq!(k.lookup("f11", false), Some(ActionId::Fullscreen)); assert_eq!(k.lookup("w", false), Some(ActionId::Screenshot)); assert_eq!(k.lookup("y", false), Some(ActionId::SubtitleStyle)); @@ -1344,8 +1438,14 @@ mod tests { // the sync points a cut has to land on to be copied. assert_eq!(k.lookup("[", true), Some(ActionId::PrevSyncPoint)); assert_eq!(k.lookup("]", true), Some(ActionId::NextSyncPoint)); - assert_eq!(k.lookup("[", false), Some(ActionId::SelectPrev)); - assert_eq!(k.lookup("]", false), Some(ActionId::SelectNext)); + assert_eq!( + k.lookup_shifted("]", false, true), + Some(ActionId::SelectNext) + ); + assert_eq!( + k.lookup_shifted("[", false, true), + Some(ActionId::SelectPrev) + ); assert_eq!(k.lookup("i", false), Some(ActionId::SetIn)); assert_eq!(k.lookup("o", false), Some(ActionId::SetOut)); assert_eq!(k.lookup("u", true), Some(ActionId::ClearRange)); @@ -1360,8 +1460,14 @@ mod tests { assert_eq!(k.lookup("g", true), Some(ActionId::Group)); // The keyboard's way onto a clip, and the pair that walks the lane. assert_eq!(k.lookup("tab", false), Some(ActionId::Select)); - assert_eq!(k.lookup("]", false), Some(ActionId::SelectNext)); - assert_eq!(k.lookup("[", false), Some(ActionId::SelectPrev)); + assert_eq!( + k.lookup_shifted("]", false, true), + Some(ActionId::SelectNext) + ); + assert_eq!( + k.lookup_shifted("[", false, true), + Some(ActionId::SelectPrev) + ); assert_eq!(k.lookup("x", false), Some(ActionId::Delete)); assert_eq!(k.lookup("delete", false), Some(ActionId::Delete)); assert_eq!(k.lookup("l", false), Some(ActionId::Lift)); @@ -1569,12 +1675,16 @@ mod tests { assert_eq!(k.display(ActionId::Undo), "ctrl+z"); assert_eq!(k.lookup("z", false), None); // The action keeps its place in the display order, and the file keeps - // reading in that order too. - let order: Vec<_> = k.entries().iter().map(|b| b.action).collect(); - assert_eq!(order, ActionId::ALL.to_vec()); + // reading in that order too. Deduped, because WalkCutNext/WalkCutPrev + // still carry their own two default chords each (untouched by this + // test's rebinds) and so appear twice running. + let mut order: Vec<_> = k.entries().iter().map(|b| b.action).collect(); + order.dedup(); + assert_eq!(order, ActionId::ALL); assert_eq!(emit(&k), emit(&whole(&emit(&k)))); - // Every action is now single-bound, so the file is one line each. - assert_eq!(k.entries().len(), ActionId::ALL.len()); + // Every action is single-bound except WalkCutNext/WalkCutPrev, still + // two chords each -- one line per action, plus those two extras. + assert_eq!(k.entries().len(), ActionId::ALL.len() + 2); } #[test] diff --git a/crates/app/src/oracle.rs b/crates/app/src/oracle.rs index bd4c035..77bba5a 100644 --- a/crates/app/src/oracle.rs +++ b/crates/app/src/oracle.rs @@ -257,6 +257,19 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable { ActionId::Copy | ActionId::Delete | ActionId::Lift if ctx.clip.is_none() => { Enable::No("click a clip first") } + // The cut machinery (DESIGN.md §6): the odometer, the trim pair and + // the loop-trim all act on the subject cut, and with none marked + // there is nothing to walk, trim or loop -- named the same way the + // three above it refuse an empty mark. + ActionId::WalkCutNext + | ActionId::WalkCutPrev + | ActionId::TrimIn + | ActionId::TrimOut + | ActionId::LoopTrim + if ctx.clip.is_none() => + { + Enable::No("no subject cut") + } ActionId::Paste if !ctx.clipboard => Enable::No("nothing copied yet"), // Nothing to draw over the picture, so nothing to switch off: the // library says how subtitles arrive, and this row would flip a state diff --git a/crates/app/src/player/actions.rs b/crates/app/src/player/actions.rs index d0d3364..28a1586 100644 --- a/crates/app/src/player/actions.rs +++ b/crates/app/src/player/actions.rs @@ -162,6 +162,13 @@ impl Player { ActionId::CancelExport => {} ActionId::ShowActions => self.show_actions(cx), ActionId::Screenshot => self.take_screenshot(cx), + // Cut machinery (DESIGN.md §6): keymap.rs/oracle.rs plumbing only + // so far -- a later task wires these to real behaviour. + ActionId::WalkCutNext + | ActionId::WalkCutPrev + | ActionId::TrimIn + | ActionId::TrimOut + | ActionId::LoopTrim => {} } } @@ -472,6 +479,7 @@ impl Player { let chord = keymap::Chord { key: key.to_string(), ctrl, + shift: false, }; // Only a stroke the file can spell and read back as itself: gpui reports // "+" for shift+=, which is the chord grammar's separator, so binding it diff --git a/crates/app/src/tests/view.rs b/crates/app/src/tests/view.rs index 3e95f4e..7a90663 100644 --- a/crates/app/src/tests/view.rs +++ b/crates/app/src/tests/view.rs @@ -410,6 +410,7 @@ fn no_stroke_is_missing_from_the_keys_menu() { let pretty = keymap::Chord { key: key.to_string(), ctrl: false, + shift: false, } .pretty(); keymap.lookup(key, false).is_some() || keymap::FIXED.iter().any(|f| f.chord == pretty) diff --git a/crates/app/src/ui/overlays.rs b/crates/app/src/ui/overlays.rs index 7e2f9f2..04e0565 100644 --- a/crates/app/src/ui/overlays.rs +++ b/crates/app/src/ui/overlays.rs @@ -213,6 +213,7 @@ impl Player { let out = keymap::Chord { key: ESCAPE.to_string(), ctrl: false, + shift: false, } .pretty(); // Every action there is, under its heading, and the strokes the modal diff --git a/crates/app/src/ui/theme.rs b/crates/app/src/ui/theme.rs index 1713500..eb9b874 100644 --- a/crates/app/src/ui/theme.rs +++ b/crates/app/src/ui/theme.rs @@ -78,10 +78,16 @@ macro_rules! palette { Palette { $($name: nord::$name,)+ }, Palette { $($name: gruvbox::$name,)+ }, Palette { $($name: dracula::$name,)+ }, + Palette { $($name: darkroom::$name,)+ }, ]; $( #[allow(non_snake_case)] + // corner-cut: the Darkroom substrate roles (INK1.. SAFELIGHT_GLYPH) + // have no call site yet -- this task owns theme.rs only and wires + // the table, not the paints. Ceiling: drop this attribute once the + // render-side task in the same DESIGN §12 package reads them. + #[allow(dead_code)] #[inline] pub fn $name() -> $ty { palette().$name } )+ @@ -124,6 +130,22 @@ palette! { EQ_FILL_INK: u32, EQ_BELL_INK: u32, HIST_INK: [u32; 3], + // -- Darkroom token substrate (DESIGN.md §2) -------------------------------- + INK1: u32, + INK2: u32, + INK3: u32, + INK4: u32, + DARK_CANVAS: u32, + DARK_PANEL: u32, + DARK_RAISED: u32, + DARK_HAIRLINE: u32, + DARK_SEAM: u32, + LAMP_WHITE: u32, + NOTICE_TELL: u32, + NOTICE_LOOK: u32, + NOTICE_DECIDE: u32, + SAFELIGHT_GROUND: u32, + SAFELIGHT_GLYPH: u32, } /// Which family a person picked. An enum and not a bool: the door in the @@ -143,13 +165,14 @@ pub enum PaletteId { Nord, Gruvbox, Dracula, + Darkroom, } impl PaletteId { /// Display order -- the picker lists them in it, and the index into /// [`PALETTES`] *is* the position in it, so this order and that array are /// the same order or every colour is wrong. - pub const ALL: [PaletteId; 12] = [ + pub const ALL: [PaletteId; 13] = [ PaletteId::Cool, PaletteId::Warm, PaletteId::Forest, @@ -162,6 +185,7 @@ impl PaletteId { PaletteId::Nord, PaletteId::Gruvbox, PaletteId::Dracula, + PaletteId::Darkroom, ]; /// What the button and the picker row call it. @@ -179,6 +203,7 @@ impl PaletteId { PaletteId::Nord => "Nord", PaletteId::Gruvbox => "Gruvbox", PaletteId::Dracula => "Dracula", + PaletteId::Darkroom => "Darkroom", } } @@ -201,6 +226,7 @@ impl PaletteId { PaletteId::Nord => "polar night, frost accent", PaletteId::Gruvbox => "retro brown, gruvbox orange", PaletteId::Dracula => "dracula ground, pink accent", + PaletteId::Darkroom => "dark ground, no chrome hue", } } @@ -220,6 +246,7 @@ impl PaletteId { PaletteId::Nord => "nord", PaletteId::Gruvbox => "gruvbox", PaletteId::Dracula => "dracula", + PaletteId::Darkroom => "darkroom", } } @@ -371,6 +398,22 @@ pub mod cool { pub const EQ_FILL_INK: u32 = 0x22d3ee26; pub const EQ_BELL_INK: u32 = 0x22d3ee66; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family A: a warm consumer-editor ground (Movavi's bed, CapCut's saturation) @@ -435,6 +478,22 @@ pub mod warm { pub const EQ_FILL_INK: u32 = 0xff7a4526; pub const EQ_BELL_INK: u32 = 0xff7a4566; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family C: the ground itself green, dark enough that a graded frame is still @@ -503,6 +562,22 @@ pub mod forest { /// The three channel inks are the picture's own R, G and B: they mean the /// same thing in every family, so they are the same numbers in every family. pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family D: an indigo ground with one lavender accent -- the cold end of the @@ -562,6 +637,22 @@ pub mod violet { pub const EQ_FILL_INK: u32 = 0xa78bfa26; pub const EQ_BELL_INK: u32 = 0xa78bfa66; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family E: a ground with no cast at all -- the neutral one, for grading, where @@ -622,6 +713,22 @@ pub mod rose { pub const EQ_FILL_INK: u32 = 0xfb718526; pub const EQ_BELL_INK: u32 = 0xfb718566; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family F: a graphite ground -- neutral, a touch warm -- under one gold @@ -682,6 +789,22 @@ pub mod amber { pub const EQ_FILL_INK: u32 = 0xfbbf2426; pub const EQ_BELL_INK: u32 = 0xfbbf2466; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family G: a blue-black ground -- deeper and bluer than `cool`'s neutral -- @@ -739,6 +862,22 @@ pub mod ocean { pub const EQ_FILL_INK: u32 = 0x38bdf826; pub const EQ_BELL_INK: u32 = 0x38bdf866; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family H: the crisp one. A near-black blue ground with the widest ink range @@ -799,6 +938,22 @@ pub mod ice { pub const EQ_FILL_INK: u32 = 0xa5f3fc26; pub const EQ_BELL_INK: u32 = 0xa5f3fc66; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family I: a dark plum ground under one orchid accent -- the warm end of the @@ -857,6 +1012,22 @@ pub mod orchid { pub const EQ_FILL_INK: u32 = 0xd946ef26; pub const EQ_BELL_INK: u32 = 0xd946ef66; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family J: Nord, the arctic palette (arcticicestudio/nord, MIT) -- Polar @@ -930,6 +1101,22 @@ pub mod nord { pub const EQ_FILL_INK: u32 = 0x88c0d026; pub const EQ_BELL_INK: u32 = 0x88c0d066; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family K: Gruvbox dark (morhetz/gruvbox, MIT) -- the retro brown-grey ground @@ -996,6 +1183,22 @@ pub mod gruvbox { pub const EQ_FILL_INK: u32 = 0xfe801926; pub const EQ_BELL_INK: u32 = 0xfe801966; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; } /// Family L: Dracula (dracula/dracula-theme, MIT) -- its background, current @@ -1056,6 +1259,104 @@ pub mod dracula { pub const EQ_FILL_INK: u32 = 0xff79c626; pub const EQ_BELL_INK: u32 = 0xff79c666; pub const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0]; + // -- Darkroom token substrate: aliased onto this family's nearest role ----- + pub const INK1: u32 = FG_PRIMARY; + pub const INK2: u32 = FG_SECONDARY; + pub const INK3: u32 = FG_DISABLED; + pub const INK4: u32 = FG_DISABLED; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + pub const DARK_SEAM: u32 = SCRIM; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = STATUS_SUCCESS; + pub const NOTICE_LOOK: u32 = STATUS_WARNING; + pub const NOTICE_DECIDE: u32 = STATUS_ERROR; + pub const SAFELIGHT_GROUND: u32 = BG_CANVAS; + pub const SAFELIGHT_GLYPH: u32 = ACCENT_PRIMARY; +} + +/// Family M: Darkroom (DESIGN.md §2) -- the thirteenth family and the room the +/// redesign is named after. Chrome is achromatic: every pre-existing role below +/// is a grey, distinguished by luminance rather than hue ("loudness is +/// luminance"); the only colour anywhere in this family sits on the roles +/// DESIGN.md actually gives one -- the amber safelight glyph and the two loud +/// notice tones. Everything else is the token substrate itself, taken verbatim +/// from the spec table. +pub mod darkroom { + // -- surfaces ----------------------------------------------------------- + pub const BG_CANVAS: u32 = 0x050607; + pub const BG_PANEL: u32 = 0x0e1013; + pub const BG_RAISED: u32 = 0x15181c; + pub const BG_TIMELINE: u32 = 0x08090b; + pub const BG_HOVER: u32 = 0x2a2e33; + pub const BG_HOVER_DIM: u32 = 0x1c1f24; + pub const BG_SELECTED: u32 = 0x2e3237; + pub const SCRIM: u32 = 0x050607cc; + pub const SCRIM_LIGHT: u32 = 0x05060755; + + // -- strokes -------------------------------------------------------------- + pub const STROKE_DIVIDER: u32 = 0x22262b; + /// "Focus/selection ring = 1px ink1 (lamp-adjacent, not coloured)." + pub const STROKE_SELECTED: u32 = INK1; + + // -- text ------------------------------------------------------------------- + pub const FG_PRIMARY: u32 = INK1; + pub const FG_SECONDARY: u32 = INK2; + pub const FG_DISABLED: u32 = INK4; + + // -- interaction -------------------------------------------------------- + pub const ACCENT_PRIMARY: u32 = INK2; + pub const ACCENT_HOVER: u32 = INK1; + pub const ACCENT_PLAYHEAD: u32 = LAMP_WHITE; + pub const ACCENT_WASH: u32 = 0x9ba3ac55; + + // -- clip kinds (luminance steps, no hue -- held under the grey that still + // carries FG_SECONDARY at 3:1, WCAG 1.4.11) ------------------------------- + pub const CLIP_VIDEO: u32 = 0x343434; + pub const CLIP_AUDIO: u32 = 0x3d3d3d; + pub const CLIP_IMAGE: u32 = 0x464646; + pub const CLIP_TEXT: u32 = 0x4f4f4f; + + pub const SOURCE_TINTS: [u32; 4] = [0x5e656d, 0x767e87, 0x8e97a1, 0xa6afb9]; + + // -- feedback ------------------------------------------------------------- + pub const STATUS_ERROR: u32 = NOTICE_DECIDE; + pub const STATUS_WARNING: u32 = NOTICE_LOOK; + pub const STATUS_SUCCESS: u32 = INK1; + pub const STATUS_PROGRESS: u32 = ACCENT_PRIMARY; + pub const DROP_REFUSE: u32 = NOTICE_DECIDE; + + // -- subtitles -------------------------------------------------------------- + pub const SUB_FG: u32 = LAMP_WHITE; + pub const SUB_SHADE: u32 = 0x000000cc; + + // -- the equalizer graph and the histogram ------------------------------- + pub const EQ_GRID: u32 = 0x22262b; + pub const EQ_SPECTRUM_INK: u32 = 0x9ba3ac66; + pub const EQ_FILL_INK: u32 = 0x9ba3ac26; + pub const EQ_BELL_INK: u32 = 0x9ba3ac66; + pub const HIST_INK: [u32; 3] = [0x767e87, 0x9ba3ac, 0xc7cdd3]; + + // -- Darkroom token substrate (DESIGN.md §2, verbatim) ----------------------- + pub const INK1: u32 = 0xe6e9ec; + pub const INK2: u32 = 0x9ba3ac; + pub const INK3: u32 = 0x5e656d; + pub const INK4: u32 = 0x3c4249; + pub const DARK_CANVAS: u32 = BG_CANVAS; + pub const DARK_PANEL: u32 = BG_PANEL; + pub const DARK_RAISED: u32 = BG_RAISED; + pub const DARK_HAIRLINE: u32 = STROKE_DIVIDER; + /// Seam: `rgba(0,0,0,.7)`, encoded the way `SCRIM`/`SCRIM_LIGHT` are -- + /// `0xRRGGBBAA` -- so `0xb3` (179/255 ~= 0.702) is the closest byte to 70%. + pub const DARK_SEAM: u32 = 0x000000b3; + pub const LAMP_WHITE: u32 = 0xffffff; + pub const NOTICE_TELL: u32 = 0x5e656d; + pub const NOTICE_LOOK: u32 = 0xd1b564; + pub const NOTICE_DECIDE: u32 = 0xc85050; + pub const SAFELIGHT_GROUND: u32 = 0x0a0908; + pub const SAFELIGHT_GLYPH: u32 = 0xff9d57; } /// The box a button's glyph sits in, whatever the glyph happens to measure: the