forge
Explore
Log in

Don't you dare go Hollow

The palette is picked in the window, not at the build

Browse files at this commit

4ddba0cba5a42153516921ae6d7ec10cf0549417Ahmet Kaan GümüşParent: 455e3a6
  • feat
    • the palette is picked in the window, not at the build
Show full message
✨ feat(ui): the palette is picked in the window, not at the build

The two colour families were a cargo feature (`--features warm`), which
makes the choice one only whoever compiled the binary could make. Both
are now `Palette` values behind one relaxed load: a token is a call
(`BG_PANEL()`) that reads a field off a 'static table, so a swap
repaints the whole window with no restart and no lookup by name.

The door is a list, not a toggle -- Theme sits in the toolbar's View
group beside Snap, and opens the same picker the resolution and the
HDR rendition already use, so a third palette costs one line in
`PaletteId::ALL` and nothing anywhere else. The stroke is ctrl+h, the
row is in the actions card, and the list now answers the keyboard as
well as the pointer: up, down, enter, escape, on every picker in the
editor rather than only this one.

The pick is kept in ~/.config/edith/theme, beside the keybindings and
under the same XDG rule, so it survives a restart; a file that cannot
be written is said out loud. The contrast guards run against every
palette in the table now instead of the one that used to be compiled,
which is what makes a palette added later land gated.
crates/app/Cargo.tomlmodified+0 -5
@@ -7,11 +7,6 @@ edition.workspace = true
7 name = "edith"7 name = "edith"
8 path = "src/main.rs"8 path = "src/main.rs"
9 9
10-[features]
11-# The warm palette instead of the default cool one: same role names, different
12-# numbers (`ui/theme.rs`). `cargo run -p edith --features warm`.
13-warm = []
14-
15 [dependencies]10 [dependencies]
16 engine = { path = "../engine" }11 engine = { path = "../engine" }
17 gpui = "0.2.2"12 gpui = "0.2.2"
crates/app/src/keymap.rsmodified+28 -3
@@ -110,6 +110,11 @@ actions! {
110 Mix,110 Mix,
111 ToggleSnap,111 ToggleSnap,
112 ToggleSubtitles,112 ToggleSubtitles,
113+ /// The window's own colours, which belong to the person looking at them and
114+ /// not to the project: a list of the palettes, opened here and from the
115+ /// toolbar's Theme button. It was a build feature once, which made it a
116+ /// choice only whoever compiled the binary could make.
117+ Theme,
113 CancelExport,118 CancelExport,
114 /// Opens the actions card -- the list every other action is on. A door of119 /// Opens the actions card -- the list every other action is on. A door of
115 /// its own, because a card reachable only by a button in the panel is one a120 /// its own, because a card reachable only by a button in the panel is one a
@@ -168,6 +173,7 @@ impl ActionId {
168 ActionId::Mix => "Mix: track volumes and the limiter…",173 ActionId::Mix => "Mix: track volumes and the limiter…",
169 ActionId::ToggleSnap => "Snap on / off (edges, the playhead, the start)",174 ActionId::ToggleSnap => "Snap on / off (edges, the playhead, the start)",
170 ActionId::ToggleSubtitles => "Subtitles on / off over the picture",175 ActionId::ToggleSubtitles => "Subtitles on / off over the picture",
176+ ActionId::Theme => "Theme: the window's colours…",
171 ActionId::CancelExport => "Cancel export",177 ActionId::CancelExport => "Cancel export",
172 ActionId::ShowActions => "All actions and their keys…",178 ActionId::ShowActions => "All actions and their keys…",
173 }179 }
@@ -221,6 +227,7 @@ impl ActionId {
221 ActionId::Mix => "mix",227 ActionId::Mix => "mix",
222 ActionId::ToggleSnap => "toggle-snap",228 ActionId::ToggleSnap => "toggle-snap",
223 ActionId::ToggleSubtitles => "toggle-subtitles",229 ActionId::ToggleSubtitles => "toggle-subtitles",
230+ ActionId::Theme => "theme",
224 ActionId::CancelExport => "cancel-export",231 ActionId::CancelExport => "cancel-export",
225 ActionId::ShowActions => "show-actions",232 ActionId::ShowActions => "show-actions",
226 }233 }
@@ -271,7 +278,10 @@ impl ActionId {
271 | ActionId::ZoomIn278 | ActionId::ZoomIn
272 | ActionId::ZoomOut279 | ActionId::ZoomOut
273 | ActionId::ZoomFit280 | ActionId::ZoomFit
274- | ActionId::ToggleSubtitles => Category::View,281+ | ActionId::ToggleSubtitles
282+ // ...and what the whole window is painted in: it edits nothing at
283+ // all, it is what one is looking *with*.
284+ | ActionId::Theme => Category::View,
275 ActionId::Cut285 ActionId::Cut
276 | ActionId::Regroup286 | ActionId::Regroup
277 | ActionId::Detach287 | ActionId::Detach
@@ -388,7 +398,7 @@ fn codec_chord() -> String {
388 .join(" / ")398 .join(" / ")
389 }399 }
390 400
391-pub static FIXED: std::sync::LazyLock<[Fixed; 28]> = std::sync::LazyLock::new(|| {401+pub static FIXED: std::sync::LazyLock<[Fixed; 29]> = std::sync::LazyLock::new(|| {
392 [402 [
393 // Not a chord at all but a way of pressing one, and the only place the403 // Not a chord at all but a way of pressing one, and the only place the
394 // editor can say so: holding a key that moves a *value* runs it, and404 // editor can say so: holding a key that moves a *value* runs it, and
@@ -405,6 +415,15 @@ pub static FIXED: std::sync::LazyLock<[Fixed; 28]> = std::sync::LazyLock::new(||
405 category: Category::View,415 category: Category::View,
406 reach: Reach::Gesture,416 reach: Reach::Gesture,
407 },417 },
418+ // An open choice list is driven by the keyboard as well as clicked: the
419+ // list is the door to a setting, and a door only a pointer opens is one
420+ // half of this editor's users cannot use.
421+ Fixed {
422+ chord: "↑ ↓ enter".into(),
423+ label: "Move through an open choice list, and take the row",
424+ category: Category::View,
425+ reach: Reach::Click("picker-row"),
426+ },
408 Fixed {427 Fixed {
409 chord: "n".into(),428 chord: "n".into(),
410 label: "Open the custom export bitrate field — ↑↓ step it",429 label: "Open the custom export bitrate field — ↑↓ step it",
@@ -792,6 +811,11 @@ impl Keymap {
792 // the rest of the things one *looks* at, and nowhere near the811 // the rest of the things one *looks* at, and nowhere near the
793 // two keys that delete.812 // two keys that delete.
794 b(ActionId::ToggleSubtitles, "t", false),813 b(ActionId::ToggleSubtitles, "t", false),
814+ // The theme takes ctrl+h -- the h of the word, since "t" is the
815+ // subtitles and ctrl+t takes one off -- and a ctrl chord because
816+ // it is a preference set once, not a stroke wanted under a hand
817+ // that is editing.
818+ b(ActionId::Theme, "h", true),
795 b(ActionId::CancelExport, "escape", false),819 b(ActionId::CancelExport, "escape", false),
796 // The help key, where every program's list of what it can do820 // The help key, where every program's list of what it can do
797 // has always been. Free -- gpui names it "f1"821 // has always been. Free -- gpui names it "f1"
@@ -1061,8 +1085,9 @@ mod tests {
1061 #[test]1085 #[test]
1062 fn every_default_stroke_reaches_its_action() {1086 fn every_default_stroke_reaches_its_action() {
1063 let k = Keymap::defaults();1087 let k = Keymap::defaults();
1064- assert_eq!(k.entries().len(), 48);1088+ assert_eq!(k.entries().len(), 49);
1065 assert_eq!(k.lookup("f1", false), Some(ActionId::ShowActions));1089 assert_eq!(k.lookup("f1", false), Some(ActionId::ShowActions));
1090+ assert_eq!(k.lookup("h", true), Some(ActionId::Theme));
1066 assert_eq!(k.lookup("space", false), Some(ActionId::Play));1091 assert_eq!(k.lookup("space", false), Some(ActionId::Play));
1067 // The seek keys: bare arrows a frame, ctrl arrows a second, and the two1092 // The seek keys: bare arrows a frame, ctrl arrows a second, and the two
1068 // ends of the timeline.1093 // ends of the timeline.
crates/app/src/main.rsmodified+231 -70
@@ -617,6 +617,11 @@ struct LibraryMenu {
617 struct Picker {617 struct Picker {
618 of: Pick,618 of: Pick,
619 at: Point<Pixels>,619 at: Point<Pixels>,
620+ /// Which row the keyboard is on, from the value in force when the list
621+ /// opened. The list answers ↑↓ and enter as well as a click: a setting whose
622+ /// only door is a pointer is a setting half this editor's users cannot
623+ /// reach, which is the rule `FIXED` already writes down for every card.
624+ sel: usize,
620 }625 }
621 626
622 /// Which setting an open list is offering. The fit policy names the clip it is627 /// Which setting an open list is offering. The fit policy names the clip it is
@@ -634,6 +639,10 @@ enum Pick {
634 /// ([`engine::tonemap::Preset`]). Opened from the panel, beside the two639 /// ([`engine::tonemap::Preset`]). Opened from the panel, beside the two
635 /// other settings that are the project's rather than the media's.640 /// other settings that are the project's rather than the media's.
636 Tone,641 Tone,
642+ /// Which palette the window is painted in ([`ui::theme`]). The one setting
643+ /// here that is nobody's project: it is the person's, so it outlives the
644+ /// timeline and every file opened in it.
645+ Theme,
637 }646 }
638 647
639 /// One value a list offers, carrying everything picking it needs -- so a click648 /// One value a list offers, carrying everything picking it needs -- so a click
@@ -649,6 +658,7 @@ enum Choice {
649 Fit(Lane, usize, FitPolicy),658 Fit(Lane, usize, FitPolicy),
650 AudioRate(u32),659 AudioRate(u32),
651 Tone(Preset),660 Tone(Preset),
661+ Theme(ui::theme::PaletteId),
652 }662 }
653 663
654 /// One row of an open list: the value, its name, the small print beside it, and664 /// One row of an open list: the value, its name, the small print beside it, and
@@ -1743,6 +1753,10 @@ impl Player {
1743 ActionId::Mix => self.open_mix(None, cx),1753 ActionId::Mix => self.open_mix(None, cx),
1744 ActionId::ToggleSnap => self.toggle_snap(cx),1754 ActionId::ToggleSnap => self.toggle_snap(cx),
1745 ActionId::ToggleSubtitles => self.toggle_subtitles(cx),1755 ActionId::ToggleSubtitles => self.toggle_subtitles(cx),
1756+ // The keyboard's door to the same list the toolbar button opens.
1757+ // At the window's corner, since a stroke names no place -- and
1758+ // [`menu_at`] keeps it on screen from there.
1759+ ActionId::Theme => self.open_picker(Pick::Theme, Point::default(), cx),
1746 // Nothing to cancel while nothing is exporting; the export guard in1760 // Nothing to cancel while nothing is exporting; the export guard in
1747 // the key handler is what answers this one while there is.1761 // the key handler is what answers this one while there is.
1748 ActionId::CancelExport => {}1762 ActionId::CancelExport => {}
@@ -2135,9 +2149,16 @@ impl Player {
2135 /// thing at a time: the click that opens it is the click that closes2149 /// thing at a time: the click that opens it is the click that closes
2136 /// whatever menu it was opened from.2150 /// whatever menu it was opened from.
2137 fn open_picker(&mut self, of: Pick, at: Point<Pixels>, cx: &mut Context<Self>) {2151 fn open_picker(&mut self, of: Pick, at: Point<Pixels>, cx: &mut Context<Self>) {
2152+ // On the row that is in force, so the first ↑ or ↓ steps off the
2153+ // current value rather than off the top of the list.
2154+ let sel = self
2155+ .choices(of)
2156+ .iter()
2157+ .position(|(.., picked)| *picked)
2158+ .unwrap_or(0);
2138 self.context_menu = None;2159 self.context_menu = None;
2139 self.library_menu = None;2160 self.library_menu = None;
2140- self.picker = Some(Picker { of, at });2161+ self.picker = Some(Picker { of, at, sel });
2141 cx.notify();2162 cx.notify();
2142 }2163 }
2143 2164
@@ -2151,6 +2172,21 @@ impl Player {
2151 Choice::Fps(fps) => self.apply_frame_rate(fps, cx),2172 Choice::Fps(fps) => self.apply_frame_rate(fps, cx),
2152 Choice::Fit(lane, idx, fit) => self.apply_fit(lane, idx, fit, cx),2173 Choice::Fit(lane, idx, fit) => self.apply_fit(lane, idx, fit, cx),
2153 Choice::Tone(preset) => self.apply_tone(preset, cx),2174 Choice::Tone(preset) => self.apply_tone(preset, cx),
2175+ // In force for the next paint -- every token is read through
2176+ // [`ui::theme::palette`], so one store repaints the whole window --
2177+ // and kept for the next launch. A file that could not be written is
2178+ // said out loud: the difference between "picked" and "picked for
2179+ // good" is the user's to know.
2180+ Choice::Theme(id) => {
2181+ ui::theme::set(id);
2182+ if let Err(e) = ui::theme::save(id) {
2183+ let path = ui::theme::config_path();
2184+ self.notify_user(
2185+ format!("THEME COULD NOT BE KEPT — {} — {e}", path.display()).into(),
2186+ );
2187+ }
2188+ cx.notify();
2189+ }
2154 // The same field the row's key steps, set outright: a list picks a2190 // The same field the row's key steps, set outright: a list picks a
2155 // value, it does not step to one.2191 // value, it does not step to one.
2156 Choice::AudioRate(kbps) => {2192 Choice::AudioRate(kbps) => {
@@ -2164,6 +2200,22 @@ impl Player {
2164 /// without a timeline, which is the state where nothing here has a value to2200 /// without a timeline, which is the state where nothing here has a value to
2165 /// offer -- and where the surfaces that open the list are dimmed anyway.2201 /// offer -- and where the surfaces that open the list are dimmed anyway.
2166 fn choices(&self, of: Pick) -> Vec<ChoiceRow> {2202 fn choices(&self, of: Pick) -> Vec<ChoiceRow> {
2203+ // The palette is not the project's, so it is offered before the
2204+ // timeline is asked about: an empty window is painted too, and its
2205+ // Theme button is live there like the snap beside it.
2206+ if of == Pick::Theme {
2207+ return ui::theme::PaletteId::ALL
2208+ .into_iter()
2209+ .map(|id| {
2210+ (
2211+ Choice::Theme(id),
2212+ id.label().into(),
2213+ id.detail().into(),
2214+ id == ui::theme::active(),
2215+ )
2216+ })
2217+ .collect();
2218+ }
2167 let Some(session) = &self.session else {2219 let Some(session) = &self.session else {
2168 return Vec::new();2220 return Vec::new();
2169 };2221 };
@@ -2177,6 +2229,8 @@ impl Player {
2177 }2229 }
2178 Pick::AudioRate => audio_rate_choices(self.audio_kbps),2230 Pick::AudioRate => audio_rate_choices(self.audio_kbps),
2179 Pick::Tone => tone_choices(session.tone()),2231 Pick::Tone => tone_choices(session.tone()),
2232+ // Answered above, with or without a timeline.
2233+ Pick::Theme => Vec::new(),
2180 }2234 }
2181 }2235 }
2182 2236
@@ -3766,7 +3820,7 @@ impl Player {
3766 .map_or(0, |session| session.file_frames(path)),3820 .map_or(0, |session| session.file_frames(path)),
3767 // A path with no source entry has no colour of its own, and the3821 // A path with no source entry has no colour of its own, and the
3768 // shadow wears the lane's own instead of borrowing another file's.3822 // shadow wears the lane's own instead of borrowing another file's.
3769- tint: file_tint(self.sources(), path).unwrap_or(BG_RAISED),3823+ tint: file_tint(self.sources(), path).unwrap_or(BG_RAISED()),
3770 refused: lane_refuses(path, to).is_some(),3824 refused: lane_refuses(path, to).is_some(),
3771 };3825 };
3772 self.set_ghost(Some(ghost), cx);3826 self.set_ghost(Some(ghost), cx);
@@ -4809,9 +4863,10 @@ impl Player {
4809 /// would name a *different* track -- and the pick is what an export writes4863 /// would name a *different* track -- and the pick is what an export writes
4810 /// into the file.4864 /// into the file.
4811 ///4865 ///
4812- /// Not an undo step: subtitles are not on the history's snapshots, so the4866+ /// Not an undo step: subtitles are not on the history's snapshots. The way
4813- /// way back is importing the file again. The notice says that rather than4867+ /// back is the row the removal leaves behind under the list
4814- /// promising a ctrl+z that would do nothing.4868+ /// ([`Player::restore_subtitle_track`]) -- a click, not a re-import -- and
4869+ /// the notice says so rather than promising a ctrl+z that would do nothing.
4815 fn remove_subtitle_track(&mut self, track: usize, cx: &mut Context<Self>) {4870 fn remove_subtitle_track(&mut self, track: usize, cx: &mut Context<Self>) {
4816 // The one availability oracle, for the same reason the × on a row and4871 // The one availability oracle, for the same reason the × on a row and
4817 // the stroke are one call: an empty list is not a failure, it is an4872 // the stroke are one call: an empty list is not a failure, it is an
@@ -4848,7 +4903,7 @@ impl Player {
4848 // ponytail: its atlas tile is not released -- `close_session`'s4903 // ponytail: its atlas tile is not released -- `close_session`'s
4849 // note, for its reason and with its upgrade path.4904 // note, for its reason and with its upgrade path.
4850 self.sub_image = None;4905 self.sub_image = None;
4851- format!("{name} REMOVED — importing the file again brings it back")4906+ format!("{name} REMOVED — it is under the list; click it to bring it back")
4852 }4907 }
4853 Some(Err(e)) => format!("NO SUBTITLES REMOVED — {e}"),4908 Some(Err(e)) => format!("NO SUBTITLES REMOVED — {e}"),
4854 None => "NO SUBTITLES REMOVED — open a file first".to_string(),4909 None => "NO SUBTITLES REMOVED — open a file first".to_string(),
@@ -4858,6 +4913,42 @@ impl Player {
4858 cx.notify();4913 cx.notify();
4859 }4914 }
4860 4915
4916+ /// The removed row's own way back: the `+` under the subtitle list, and the
4917+ /// row itself. The track goes back on the timeline with the cues it was
4918+ /// removed with ([`engine::PlaybackSession::restore_subtitles`]) -- no file
4919+ /// is read again, which is the whole complaint this answers.
4920+ ///
4921+ /// The restored track becomes the pick and the overlay goes on, for the
4922+ /// reason a click on a live row does: bringing a subtitle back is asking to
4923+ /// see it, and a restore that changed nothing on screen would read as a
4924+ /// dead row.
4925+ fn restore_subtitle_track(&mut self, removed: usize, cx: &mut Context<Self>) {
4926+ let name = self
4927+ .session
4928+ .as_ref()
4929+ .and_then(|session| sub_pick_name(session.removed_subtitles(), removed))
4930+ .unwrap_or_else(|| format!("subtitle track {removed}"));
4931+ let text = match self
4932+ .session
4933+ .as_mut()
4934+ .map(|session| session.restore_subtitles(removed))
4935+ {
4936+ Some(Ok(track)) => {
4937+ self.sub_track = track;
4938+ self.subs_on = true;
4939+ // The drawn cue is keyed by the pick, which has just moved --
4940+ // `remove_subtitle_track`'s note, for its reason.
4941+ self.sub_image = None;
4942+ format!("{name} IS BACK — showing over the picture")
4943+ }
4944+ Some(Err(e)) => format!("NOTHING BROUGHT BACK — {e}"),
4945+ None => "NOTHING BROUGHT BACK — open a file first".to_string(),
4946+ };
4947+ eprintln!("{text}");
4948+ self.notify_user(text.into());
4949+ cx.notify();
4950+ }
4951+
4861 /// Swaps the whole timeline for one restored from a `.edith`, for4952 /// Swaps the whole timeline for one restored from a `.edith`, for
4862 /// [`Player::install_media`]'s reason: the open is a worker's -- a project4953 /// [`Player::install_media`]'s reason: the open is a worker's -- a project
4863 /// naming a 24 GB film opens that film, which is the same twenty seconds4954 /// naming a 24 GB film opens that film, which is the same twenty seconds
@@ -5983,6 +6074,28 @@ impl Render for Player {
5983 // stroke exactly as the clip menu does.6074 // stroke exactly as the clip menu does.
5984 // A choice list goes the same way and for the same reason: it6075 // A choice list goes the same way and for the same reason: it
5985 // names a clip index too, and escape is the way out of it.6076 // names a clip index too, and escape is the way out of it.
6077+ // An open list is the innermost thing on screen, so it takes
6078+ // the keys before anything under it does: ↑↓ walk it, enter
6079+ // takes the row, and escape falls through to the close below --
6080+ // the same three strokes every list in this editor answers.
6081+ if let Some(mut picker) = this.picker {
6082+ let rows = this.choices(picker.of);
6083+ if !rows.is_empty() && matches!(key, "up" | "down" | "enter") {
6084+ match key {
6085+ "down" => picker.sel = (picker.sel + 1) % rows.len(),
6086+ "up" => picker.sel = (picker.sel + rows.len() - 1) % rows.len(),
6087+ _ => {
6088+ let (choice, ..) = rows[picker.sel.min(rows.len() - 1)];
6089+ this.choose(choice, cx);
6090+ cx.notify();
6091+ return;
6092+ }
6093+ }
6094+ this.picker = Some(picker);
6095+ cx.notify();
6096+ return;
6097+ }
6098+ }
5986 let clip_menu = this.context_menu.take().is_some();6099 let clip_menu = this.context_menu.take().is_some();
5987 let row_menu = this.library_menu.take().is_some();6100 let row_menu = this.library_menu.take().is_some();
5988 let list = this.picker.take().is_some();6101 let list = this.picker.take().is_some();
@@ -6054,8 +6167,8 @@ impl Render for Player {
6054 .size_full()6167 .size_full()
6055 .flex()6168 .flex()
6056 .flex_col()6169 .flex_col()
6057- .bg(rgb(BG_CANVAS))6170+ .bg(rgb(BG_CANVAS()))
6058- .text_color(rgb(FG_PRIMARY))6171+ .text_color(rgb(FG_PRIMARY()))
6059 .text_size(px(12.))6172 .text_size(px(12.))
6060 // Four regions, the arrangement every consumer editor shares:6173 // Four regions, the arrangement every consumer editor shares:
6061 // library left, picture centre, inspector right, and the timeline6174 // library left, picture centre, inspector right, and the timeline
@@ -6093,7 +6206,7 @@ impl Render for Player {
6093 .flex()6206 .flex()
6094 .justify_center()6207 .justify_center()
6095 .items_center()6208 .items_center()
6096- .bg(rgb(BG_CANVAS))6209+ .bg(rgb(BG_CANVAS()))
6097 .children(6210 .children(
6098 self.image6211 self.image
6099 .clone()6212 .clone()
@@ -7133,6 +7246,12 @@ fn enable(action: ActionId, ctx: Ctx) -> Enable {
7133 // window has no clips and still has keys -- so this answers ahead of the7246 // window has no clips and still has keys -- so this answers ahead of the
7134 // timeline question, and only an export shuts it (a waiting row would7247 // timeline question, and only an export shuts it (a waiting row would
7135 // swallow the escape the progress line promises cancels the export).7248 // swallow the escape the progress line promises cancels the export).
7249+ // The window's own colours: there is always a window, and repainting it
7250+ // touches no timeline -- so this one is live even while an export is
7251+ // reading one, which is the only state that dims the list above.
7252+ if action == ActionId::Theme {
7253+ return Enable::Yes;
7254+ }
7136 if action == ActionId::ShowActions {7255 if action == ActionId::ShowActions {
7137 return match ctx.exporting {7256 return match ctx.exporting {
7138 true => Enable::No("an export is running"),7257 true => Enable::No("an export is running"),
@@ -7734,7 +7853,7 @@ fn window_title(name: &str) -> String {
7734 /// palette two sources share a colour, which is a smaller lie than a fifth tint7853 /// palette two sources share a colour, which is a smaller lie than a fifth tint
7735 /// bright enough to leave the family.7854 /// bright enough to leave the family.
7736 fn source_tint(source: usize) -> u32 {7855 fn source_tint(source: usize) -> u32 {
7737- SOURCE_TINTS[source % SOURCE_TINTS.len()]7856+ SOURCE_TINTS()[source % SOURCE_TINTS().len()]
7738 }7857 }
7739 7858
7740 /// The tint of a *file*, which is what a library row is named by: the first7859 /// The tint of a *file*, which is what a library row is named by: the first
@@ -9368,7 +9487,7 @@ fn hist_curves(bins: [[u32; HIST_BINS]; 3]) -> impl IntoElement {
9368 }9487 }
9369 }9488 }
9370 if let Ok(path) = path.build() {9489 if let Ok(path) = path.build() {
9371- window.paint_path(path, rgb(HIST_INK[channel]));9490+ window.paint_path(path, rgb(HIST_INK()[channel]));
9372 }9491 }
9373 }9492 }
9374 },9493 },
@@ -9494,7 +9613,7 @@ fn eq_spectrum_curve(levels: Vec<f32>) -> impl IntoElement {
9494 path.line_to(point(o.x + s.width, o.y + s.height));9613 path.line_to(point(o.x + s.width, o.y + s.height));
9495 path.close();9614 path.close();
9496 if let Ok(path) = path.build() {9615 if let Ok(path) = path.build() {
9497- window.paint_path(path, rgba(EQ_SPECTRUM_INK));9616+ window.paint_path(path, rgba(EQ_SPECTRUM_INK()));
9498 }9617 }
9499 },9618 },
9500 )9619 )
@@ -9547,7 +9666,7 @@ fn eq_curve(params: EqParams, sample_rate: u32) -> impl IntoElement {
9547 }9666 }
9548 }9667 }
9549 if let Ok(bell) = bell.build() {9668 if let Ok(bell) = bell.build() {
9550- window.paint_path(bell, rgba(EQ_BELL_INK));9669+ window.paint_path(bell, rgba(EQ_BELL_INK()));
9551 }9670 }
9552 }9671 }
9553 let points = line(&params);9672 let points = line(&params);
@@ -9562,7 +9681,7 @@ fn eq_curve(params: EqParams, sample_rate: u32) -> impl IntoElement {
9562 area.line_to(point(o.x + s.width, o.y + s.height / 2.));9681 area.line_to(point(o.x + s.width, o.y + s.height / 2.));
9563 area.close();9682 area.close();
9564 if let Ok(area) = area.build() {9683 if let Ok(area) = area.build() {
9565- window.paint_path(area, rgba(EQ_FILL_INK));9684+ window.paint_path(area, rgba(EQ_FILL_INK()));
9566 }9685 }
9567 let mut path = PathBuilder::stroke(px(2.));9686 let mut path = PathBuilder::stroke(px(2.));
9568 for (step, at) in points.into_iter().enumerate() {9687 for (step, at) in points.into_iter().enumerate() {
@@ -9572,7 +9691,7 @@ fn eq_curve(params: EqParams, sample_rate: u32) -> impl IntoElement {
9572 }9691 }
9573 }9692 }
9574 if let Ok(path) = path.build() {9693 if let Ok(path) = path.build() {
9575- window.paint_path(path, rgb(ACCENT_PRIMARY));9694+ window.paint_path(path, rgb(ACCENT_PRIMARY()));
9576 }9695 }
9577 },9696 },
9578 )9697 )
@@ -9975,7 +10094,7 @@ mod tests {
9975 // function -- what makes the panel and the lanes one association.10094 // function -- what makes the panel and the lanes one association.
9976 for row in 0..rows.len() {10095 for row in 0..rows.len() {
9977 assert_eq!(rows[row].tint, row);10096 assert_eq!(rows[row].tint, row);
9978- assert_eq!(source_tint(row), SOURCE_TINTS[row % SOURCE_TINTS.len()]);10097+ assert_eq!(source_tint(row), SOURCE_TINTS()[row % SOURCE_TINTS().len()]);
9979 }10098 }
9980 }10099 }
9981 10100
@@ -10451,9 +10570,14 @@ mod tests {
10451 };10570 };
10452 assert!(whole(ActionId::CancelExport, busy).yes());10571 assert!(whole(ActionId::CancelExport, busy).yes());
10453 for action in ActionId::ALL {10572 for action in ActionId::ALL {
10573+ // Nothing may touch the edit list while an export is reading it --
10574+ // and the palette does not: it repaints this window and writes one
10575+ // word to the user's own config file, which is why it is the one
10576+ // action besides the cancel that stays live here.
10577+ let allowed = action == ActionId::CancelExport || action == ActionId::Theme;
10454 assert_eq!(10578 assert_eq!(
10455 whole(action, busy).yes(),10579 whole(action, busy).yes(),
10456- action == ActionId::CancelExport,10580+ allowed,
10457 "{action:?} while an export reads the edit list"10581 "{action:?} while an export reads the edit list"
10458 );10582 );
10459 }10583 }
@@ -13466,21 +13590,27 @@ mod tests {
13466 // in its column -- is body text on `BG_RAISED` and WCAG 1.4.3 binds it.13590 // in its column -- is body text on `BG_RAISED` and WCAG 1.4.3 binds it.
13467 // A dimmed row is drawn in this ink rather than at an opacity, which is13591 // A dimmed row is drawn in this ink rather than at an opacity, which is
13468 // what a refusal used to be readable through.13592 // what a refusal used to be readable through.
13469- assert!(13593+ // Every palette, not the one in force: a family is picked at runtime
13470- contrast(FG_SECONDARY, BG_RAISED) >= 4.5,13594+ // now (`ui::theme`), so a floor met by one of them and missed by the
13471- "refusal ink {:.2}",13595+ // other is a window somebody is looking at.
13472- contrast(FG_SECONDARY, BG_RAISED)13596+ for id in crate::ui::theme::PaletteId::ALL {
13473- );13597+ let p = id.palette();
13598+ assert!(
13599+ contrast(p.FG_SECONDARY, p.BG_RAISED) >= 4.5,
13600+ "{id:?}: refusal ink {:.2}",
13601+ contrast(p.FG_SECONDARY, p.BG_RAISED)
13602+ );
13474 // ...and on the picked row, where the highlight is the accent at13603 // ...and on the picked row, where the highlight is the accent at
13475 // surface brightness. Both inks clear 4.5:1 on it now -- the row still13604 // surface brightness. Both inks clear 4.5:1 on it now -- the row still
13476 // lifts its key and detail to `FG_PRIMARY`, as emphasis rather than as13605 // lifts its key and detail to `FG_PRIMARY`, as emphasis rather than as
13477 // the rescue it used to be.13606 // the rescue it used to be.
13478- assert!(contrast(FG_PRIMARY, BG_SELECTED) >= 4.5);13607+ assert!(contrast(p.FG_PRIMARY, p.BG_SELECTED) >= 4.5, "{id:?}");
13479- assert!(13608+ assert!(
13480- contrast(FG_SECONDARY, BG_SELECTED) >= 4.5,13609+ contrast(p.FG_SECONDARY, p.BG_SELECTED) >= 4.5,
13481- "refusal ink on the picked row {:.2}",13610+ "{id:?}: refusal ink on the picked row {:.2}",
13482- contrast(FG_SECONDARY, BG_SELECTED)13611+ contrast(p.FG_SECONDARY, p.BG_SELECTED)
13483- );13612+ );
13613+ }
13484 }13614 }
13485 13615
13486 /// The progress line's two clocks, driven the way a repaint drives them:13616 /// The progress line's two clocks, driven the way a repaint drives them:
@@ -14347,7 +14477,9 @@ mod tests {
14347 assert!(SUB_LINE_H >= SUB_TEXT);14477 assert!(SUB_LINE_H >= SUB_TEXT);
14348 // White on the plate, not chrome on chrome: a cue is read against the14478 // White on the plate, not chrome on chrome: a cue is read against the
14349 // film, and this is the one pair here that has to survive any picture.14479 // film, and this is the one pair here that has to survive any picture.
14350- assert!(contrast(SUB_FG, 0x000000) >= 7.);14480+ for id in crate::ui::theme::PaletteId::ALL {
14481+ assert!(contrast(id.palette().SUB_FG, 0x000000) >= 7., "{id:?}");
14482+ }
14351 // The strip is a picture and not a target -- nothing on it takes a14483 // The strip is a picture and not a target -- nothing on it takes a
14352 // click -- which is the only reason it may be under `HIT_MIN`.14484 // click -- which is the only reason it may be under `HIT_MIN`.
14353 assert!(SUB_LANE_H < HIT_MIN && SUB_LANE_H > 0.);14485 assert!(SUB_LANE_H < HIT_MIN && SUB_LANE_H > 0.);
@@ -14711,10 +14843,10 @@ mod tests {
14711 /// the tone cannot disagree with the sentence it labels.14843 /// the tone cannot disagree with the sentence it labels.
14712 #[test]14844 #[test]
14713 fn a_message_wears_the_colour_its_own_words_say() {14845 fn a_message_wears_the_colour_its_own_words_say() {
14714- assert_eq!(notice_tone("SCAN FAILED: no audio"), STATUS_ERROR);14846+ assert_eq!(notice_tone("SCAN FAILED: no audio"), STATUS_ERROR());
14715- assert_eq!(notice_tone(&format!("{EXPORT_DONE}out.mp4")), STATUS_SUCCESS);14847+ assert_eq!(notice_tone(&format!("{EXPORT_DONE}out.mp4")), STATUS_SUCCESS());
14716- assert_eq!(notice_tone("NOTHING DETACHED — not grouped"), STATUS_WARNING);14848+ assert_eq!(notice_tone("NOTHING DETACHED — not grouped"), STATUS_WARNING());
14717- assert_eq!(notice_tone("SNAP ON"), ACCENT_PRIMARY);14849+ assert_eq!(notice_tone("SNAP ON"), ACCENT_PRIMARY());
14718 }14850 }
14719 14851
14720 /// The cards are sections of the inspector, not sheets over the timeline:14852 /// The cards are sections of the inspector, not sheets over the timeline:
@@ -15115,37 +15247,36 @@ mod tests {
15115 // ([`clip_kind`]); the source tint is the border and the library15247 // ([`clip_kind`]); the source tint is the border and the library
15116 // swatch, and is measured for telling itself apart rather than for15248 // swatch, and is measured for telling itself apart rather than for
15117 // carrying text.15249 // carrying text.
15118- for (i, tint) in [15250+ // Every palette a person can pick, not merely the one in force.
15119- crate::ui::theme::CLIP_VIDEO,15251+ for id in crate::ui::theme::PaletteId::ALL {
15120- crate::ui::theme::CLIP_AUDIO,15252+ let p = id.palette();
15121- crate::ui::theme::CLIP_IMAGE,15253+ for (i, tint) in [p.CLIP_VIDEO, p.CLIP_AUDIO, p.CLIP_IMAGE, p.CLIP_TEXT]
15122- crate::ui::theme::CLIP_TEXT,15254+ .iter()
15123- ]15255+ .enumerate()
15124- .iter()15256+ {
15125- .enumerate()15257+ // WCAG 1.4.3: the clip's name is body text on its tint.
15126- {15258+ assert!(
15127- // WCAG 1.4.3: the clip's name is body text on its tint.15259+ contrast(p.FG_PRIMARY, *tint) >= 4.5,
15128- assert!(15260+ "{id:?} source {i}: label contrast {:.2}",
15129- contrast(FG_PRIMARY, *tint) >= 4.5,15261+ contrast(p.FG_PRIMARY, *tint)
15130- "source {i}: label contrast {:.2}",15262+ );
15131- contrast(FG_PRIMARY, *tint)15263+ // WCAG 1.4.11: the waveform is a non-text graphic on it.
15132- );15264+ assert!(
15133- // WCAG 1.4.11: the waveform is a non-text graphic on it.15265+ contrast(p.FG_SECONDARY, *tint) >= 3.,
15134- assert!(15266+ "{id:?} source {i}: waveform contrast {:.2}",
15135- contrast(FG_SECONDARY, *tint) >= 3.,15267+ contrast(p.FG_SECONDARY, *tint)
15136- "source {i}: waveform contrast {:.2}",15268+ );
15137- contrast(FG_SECONDARY, *tint)15269+ }
15138- );15270+ // A selected clip's bed is the same two marks on a different colour.
15271+ assert!(contrast(p.FG_PRIMARY, p.BG_SELECTED) >= 4.5, "{id:?}");
15272+ assert!(contrast(p.FG_SECONDARY, p.BG_SELECTED) >= 3., "{id:?}");
15273+ // The bed a gap shows through has to read as a hole in the lane --
15274+ // the clip is the object, the bed is the hole -- and the playhead
15275+ // has to be findable on both.
15276+ assert!(contrast(p.CLIP_VIDEO, p.BG_TIMELINE) >= 1.5, "{id:?}");
15277+ assert!(contrast(p.ACCENT_PLAYHEAD, p.BG_TIMELINE) >= 3., "{id:?}");
15278+ assert!(contrast(p.ACCENT_PLAYHEAD, p.CLIP_VIDEO) >= 3., "{id:?}");
15139 }15279 }
15140- // A selected clip's bed is the same two marks on a different colour.
15141- assert!(contrast(FG_PRIMARY, BG_SELECTED) >= 4.5);
15142- assert!(contrast(FG_SECONDARY, BG_SELECTED) >= 3.);
15143- // The bed a gap shows through has to read as a hole in the lane -- the
15144- // clip is the object, the bed is the hole -- and the playhead has to be
15145- // findable on both.
15146- assert!(contrast(crate::ui::theme::CLIP_VIDEO, crate::ui::theme::BG_TIMELINE) >= 1.5);
15147- assert!(contrast(crate::ui::theme::ACCENT_PLAYHEAD, crate::ui::theme::BG_TIMELINE) >= 3.);
15148- assert!(contrast(crate::ui::theme::ACCENT_PLAYHEAD, crate::ui::theme::CLIP_VIDEO) >= 3.);
15149 // The sanity check on the ratio itself: black on white is 21:1.15280 // The sanity check on the ratio itself: black on white is 21:1.
15150 assert!((contrast(0xffffff, 0x000000) - 21.).abs() < 0.01);15281 assert!((contrast(0xffffff, 0x000000) - 21.).abs() < 0.01);
15151 }15282 }
@@ -15155,7 +15286,7 @@ mod tests {
15155 // The bug: the first entry *was* `BG_RAISED`, so the first file imported15286 // The bug: the first entry *was* `BG_RAISED`, so the first file imported
15156 // -- the one every session has -- wore the panel's own background and15287 // -- the one every session has -- wore the panel's own background and
15157 // had no visible swatch at all.15288 // had no visible swatch at all.
15158- assert_ne!(source_tint(0), BG_RAISED);15289+ assert_ne!(source_tint(0), BG_RAISED());
15159 // Neighbouring sources must not share one, or an import is invisible.15290 // Neighbouring sources must not share one, or an import is invisible.
15160 assert_ne!(source_tint(0), source_tint(1));15291 assert_ne!(source_tint(0), source_tint(1));
15161 assert_ne!(source_tint(1), source_tint(2));15292 assert_ne!(source_tint(1), source_tint(2));
@@ -15163,7 +15294,7 @@ mod tests {
15163 // Past the palette it wraps -- never an index panic.15294 // Past the palette it wraps -- never an index panic.
15164 assert_eq!(source_tint(4), source_tint(0));15295 assert_eq!(source_tint(4), source_tint(0));
15165 assert_eq!(source_tint(9), source_tint(1));15296 assert_eq!(source_tint(9), source_tint(1));
15166- assert_eq!(source_tint(usize::MAX), SOURCE_TINTS[usize::MAX % 4]);15297+ assert_eq!(source_tint(usize::MAX), SOURCE_TINTS()[usize::MAX % 4]);
15167 }15298 }
15168 15299
15169 /// Not "they are different numbers" -- different *enough to see*, against15300 /// Not "they are different numbers" -- different *enough to see*, against
@@ -15182,13 +15313,13 @@ mod tests {
15182 })15313 })
15183 .sum::<u32>()15314 .sum::<u32>()
15184 };15315 };
15185- for (i, &tint) in SOURCE_TINTS.iter().enumerate() {15316+ for (i, &tint) in SOURCE_TINTS().iter().enumerate() {
15186 assert!(15317 assert!(
15187- apart(tint, BG_RAISED) >= 16,15318+ apart(tint, BG_RAISED()) >= 16,
15188 "tint {i} is {} from the panel it sits on",15319 "tint {i} is {} from the panel it sits on",
15189- apart(tint, BG_RAISED)15320+ apart(tint, BG_RAISED())
15190 );15321 );
15191- for (j, &other) in SOURCE_TINTS.iter().enumerate().skip(i + 1) {15322+ for (j, &other) in SOURCE_TINTS().iter().enumerate().skip(i + 1) {
15192 assert!(15323 assert!(
15193 apart(tint, other) >= 16,15324 apart(tint, other) >= 16,
15194 "tints {i} and {j} are only {} apart",15325 "tints {i} and {j} are only {} apart",
@@ -15198,7 +15329,7 @@ mod tests {
15198 }15329 }
15199 // The two a person sees side by side first must be further apart than15330 // The two a person sees side by side first must be further apart than
15200 // the floor: source 0 and source 1 are the first import and the second.15331 // the floor: source 0 and source 1 are the first import and the second.
15201- assert!(apart(SOURCE_TINTS[0], SOURCE_TINTS[1]) >= 32);15332+ assert!(apart(SOURCE_TINTS()[0], SOURCE_TINTS()[1]) >= 32);
15202 }15333 }
15203 15334
15204 /// A `.srt` dropped on the window is nobody's stream: it has no source15335 /// A `.srt` dropped on the window is nobody's stream: it has no source
@@ -15396,6 +15527,31 @@ mod tests {
15396 assert_eq!(sub_pick_name(&[], 0), None);15527 assert_eq!(sub_pick_name(&[], 0), None);
15397 }15528 }
15398 15529
15530+ /// Whatever a removal took off can be put back from the panel, without the
15531+ /// file being imported again: the removed row and its `+` are things on
15532+ /// screen, which is what makes the way back an action and not a sentence in
15533+ /// a notice. The names on those rows come off the same
15534+ /// [`sub_pick_name`] the live ones do, so a removed track reads as the
15535+ /// track it was.
15536+ #[test]
15537+ fn a_removed_subtitle_row_has_its_way_back_in_the_panel() {
15538+ let source = ui_source();
15539+ for id in ["subtitle-restore", "subtitle-restore-button"] {
15540+ assert!(
15541+ source.contains(&format!("\"{id}\"")),
15542+ "{id} is on no row: a removed subtitle would need a re-import"
15543+ );
15544+ }
15545+ // What those rows are named by, off the removed list rather than the
15546+ // live one -- the bin's own indexes.
15547+ let gone = [
15548+ sub("/films/a.mkv", Some(1), "eng"),
15549+ sub("/subs/late.srt", None, "late.srt"),
15550+ ];
15551+ assert_eq!(sub_pick_name(&gone, 0).as_deref(), Some("eng — a"));
15552+ assert_eq!(sub_pick_name(&gone, 1).as_deref(), Some("late.srt"));
15553+ }
15554+
15399 /// The one thing regrouping must not break: `sub_track` is a flat index15555 /// The one thing regrouping must not break: `sub_track` is a flat index
15400 /// into the add-order list, a click sets it and a save writes it into the15556 /// into the add-order list, a click sets it and a save writes it into the
15401 /// `.edith`. Every row must still name the track it was made from -- rows15557 /// `.edith`. Every row must still name the track it was made from -- rows
@@ -15661,6 +15817,11 @@ fn main() {
15661 if let Some(text) = &notice {15817 if let Some(text) = &notice {
15662 eprintln!("{text}");15818 eprintln!("{text}");
15663 }15819 }
15820+ // The palette the last session picked, before the first paint: a window that
15821+ // opened cool and turned warm a frame later would be the theme announcing
15822+ // itself. Silent on a missing or unreadable file -- the default is a whole
15823+ // answer, and nothing of the user's is lost by it.
15824+ ui::theme::load();
15664 // Nothing named on the command line is read here. The first file makes the15825 // Nothing named on the command line is read here. The first file makes the
15665 // timeline -- a `.edith` restores a whole one, anything else *is* one --15826 // timeline -- a `.edith` restores a whole one, anything else *is* one --
15666 // and the rest are imports like any other: rows in the library, dragged15827 // and the rest are imports like any other: rows in the library, dragged
crates/app/src/ui/cards.rsmodified+88 -88
@@ -55,9 +55,9 @@ impl Player {
55 // an inapplicable item in the clip menu is: it still says its piece.55 // an inapplicable item in the clip menu is: it still says its piece.
56 let live = |d: Stateful<Div>, enabled: bool| {56 let live = |d: Stateful<Div>, enabled: bool| {
57 d.when(!enabled, |d| {57 d.when(!enabled, |d| {
58- d.cursor_not_allowed().text_color(rgb(FG_SECONDARY))58+ d.cursor_not_allowed().text_color(rgb(FG_SECONDARY()))
59 })59 })
60- .when(enabled, |d| d.cursor_pointer().hover(|s| s.bg(rgb(BG_HOVER))))60+ .when(enabled, |d| d.cursor_pointer().hover(|s| s.bg(rgb(BG_HOVER()))))
61 };61 };
62 // A row as this card writes them: the mark saying which one is picked,62 // A row as this card writes them: the mark saying which one is picked,
63 // the key that picks it, its name, and what the choice means. The mark63 // the key that picks it, its name, and what the choice means. The mark
@@ -74,11 +74,11 @@ impl Player {
74 // dim ink is only 3.3:1 -- the row it lands on lifts it (WCAG74 // dim ink is only 3.3:1 -- the row it lands on lifts it (WCAG
75 // 1.4.3, and the fit test pins both numbers).75 // 1.4.3, and the fit test pins both numbers).
76 let ink = match picked {76 let ink = match picked {
77- true => FG_PRIMARY,77+ true => FG_PRIMARY(),
78- false => FG_SECONDARY,78+ false => FG_SECONDARY(),
79 };79 };
80 live(row(id), enabled)80 live(row(id), enabled)
81- .when(picked, |d| d.bg(rgb(BG_SELECTED)))81+ .when(picked, |d| d.bg(rgb(BG_SELECTED())))
82 .child(82 .child(
83 div()83 div()
84 .flex()84 .flex()
@@ -116,7 +116,7 @@ impl Player {
116 .px(px(6.))116 .px(px(6.))
117 .pt(px(4.))117 .pt(px(4.))
118 .text_size(px(10.))118 .text_size(px(10.))
119- .text_color(rgb(FG_SECONDARY))119+ .text_color(rgb(FG_SECONDARY()))
120 .child(text)120 .child(text)
121 .into_any_element()121 .into_any_element()
122 };122 };
@@ -366,7 +366,7 @@ impl Player {
366 .px(px(6.))366 .px(px(6.))
367 .py(px(2.))367 .py(px(2.))
368 .text_size(px(11.))368 .text_size(px(11.))
369- .text_color(rgb(FG_SECONDARY))369+ .text_color(rgb(FG_SECONDARY()))
370 .child(format!("cannot write: {}", refusals.join(" · ")))370 .child(format!("cannot write: {}", refusals.join(" · ")))
371 .into_any_element(),371 .into_any_element(),
372 );372 );
@@ -386,7 +386,7 @@ impl Player {
386 .px(px(6.))386 .px(px(6.))
387 .py(px(2.))387 .py(px(2.))
388 .text_size(px(11.))388 .text_size(px(11.))
389- .text_color(rgb(FG_SECONDARY))389+ .text_color(rgb(FG_SECONDARY()))
390 .child(text)390 .child(text)
391 .into_any_element()391 .into_any_element()
392 };392 };
@@ -450,7 +450,7 @@ impl Player {
450 .flex()450 .flex()
451 .justify_center()451 .justify_center()
452 .items_center()452 .items_center()
453- .bg(rgba(SCRIM))453+ .bg(rgba(SCRIM()))
454 // Click away closes it, as on every card here.454 // Click away closes it, as on every card here.
455 .on_mouse_down(455 .on_mouse_down(
456 MouseButton::Left,456 MouseButton::Left,
@@ -469,7 +469,7 @@ impl Player {
469 .gap(px(2.))469 .gap(px(2.))
470 .p(px(12.))470 .p(px(12.))
471 .rounded(px(6.))471 .rounded(px(6.))
472- .bg(rgb(BG_RAISED))472+ .bg(rgb(BG_RAISED()))
473 .child(div().flex_none().px(px(6.)).child("Export"))473 .child(div().flex_none().px(px(6.)).child("Export"))
474 // The status line, where a refusal from the save dialog474 // The status line, where a refusal from the save dialog
475 // lands: the notice bar it would otherwise take is under475 // lands: the notice bar it would otherwise take is under
@@ -481,7 +481,7 @@ impl Player {
481 .flex_none()481 .flex_none()
482 .px(px(6.))482 .px(px(6.))
483 .text_size(px(11.))483 .text_size(px(11.))
484- .text_color(rgb(FG_SECONDARY))484+ .text_color(rgb(FG_SECONDARY()))
485 .child(match (&self.mbps_edit, self.notices.front()) {485 .child(match (&self.mbps_edit, self.notices.front()) {
486 // A field being typed into says so here as486 // A field being typed into says so here as
487 // well as in its row: this line is outside487 // well as in its row: this line is outside
@@ -519,7 +519,7 @@ impl Player {
519 .flex_none()519 .flex_none()
520 .px(px(6.))520 .px(px(6.))
521 .text_size(px(11.))521 .text_size(px(11.))
522- .text_color(rgb(FG_SECONDARY))522+ .text_color(rgb(FG_SECONDARY()))
523 .child(tail),523 .child(tail),
524 )524 )
525 .child(525 .child(
@@ -532,11 +532,11 @@ impl Player {
532 .justify_center()532 .justify_center()
533 .rounded(px(3.))533 .rounded(px(3.))
534 .bg(rgb(match blocked.is_some() {534 .bg(rgb(match blocked.is_some() {
535- true => BG_PANEL,535+ true => BG_PANEL(),
536- false => BG_SELECTED,536+ false => BG_SELECTED(),
537 }))537 }))
538 .cursor_pointer()538 .cursor_pointer()
539- .hover(|s| s.bg(rgb(BG_HOVER)))539+ .hover(|s| s.bg(rgb(BG_HOVER())))
540 .on_click(540 .on_click(
541 cx.listener(|this, _: &ClickEvent, _, cx| {541 cx.listener(|this, _: &ClickEvent, _, cx| {
542 this.start_export(cx)542 this.start_export(cx)
@@ -562,9 +562,9 @@ impl Player {
562 .items_center()562 .items_center()
563 .justify_center()563 .justify_center()
564 .rounded(px(3.))564 .rounded(px(3.))
565- .bg(rgb(BG_PANEL))565+ .bg(rgb(BG_PANEL()))
566 .cursor_pointer()566 .cursor_pointer()
567- .hover(|s| s.bg(rgb(BG_HOVER)))567+ .hover(|s| s.bg(rgb(BG_HOVER())))
568 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {568 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
569 this.nudge_mbps(by);569 this.nudge_mbps(by);
570 cx.notify();570 cx.notify();
@@ -637,8 +637,8 @@ impl Player {
637 .h(px(EQ_HANDLE))637 .h(px(EQ_HANDLE))
638 .rounded(px(EQ_HANDLE / 2.))638 .rounded(px(EQ_HANDLE / 2.))
639 .bg(rgb(match i == self.eq_band {639 .bg(rgb(match i == self.eq_band {
640- true => ACCENT_PRIMARY,640+ true => ACCENT_PRIMARY(),
641- false => FG_SECONDARY,641+ false => FG_SECONDARY(),
642 }))642 }))
643 })643 })
644 .collect();644 .collect();
@@ -651,7 +651,7 @@ impl Player {
651 .flex_none()651 .flex_none()
652 .h(px(EQ_GRAPH_H))652 .h(px(EQ_GRAPH_H))
653 .rounded(px(3.))653 .rounded(px(3.))
654- .bg(rgb(BG_HOVER_DIM))654+ .bg(rgb(BG_HOVER_DIM()))
655 .cursor_pointer()655 .cursor_pointer()
656 // The press picks the band under it *and* is already the first656 // The press picks the band under it *and* is already the first
657 // sample of the drag, so a plain click sets a value. A second click657 // sample of the drag, so a plain click sets a value. A second click
@@ -686,7 +686,7 @@ impl Player {
686 .left(relative(eq_x(*freq)))686 .left(relative(eq_x(*freq)))
687 .w(px(1.))687 .w(px(1.))
688 .h_full()688 .h_full()
689- .bg(rgb(EQ_GRID))689+ .bg(rgb(EQ_GRID()))
690 })690 })
691 .collect::<Vec<_>>(),691 .collect::<Vec<_>>(),
692 )692 )
@@ -698,14 +698,14 @@ impl Player {
698 .top(relative(eq_y(db)))698 .top(relative(eq_y(db)))
699 .w_full()699 .w_full()
700 .h(px(1.))700 .h(px(1.))
701- .bg(rgb(EQ_GRID))701+ .bg(rgb(EQ_GRID()))
702 .child(702 .child(
703 div()703 div()
704 .absolute()704 .absolute()
705 .left(px(4.))705 .left(px(4.))
706 .top(px(-11.))706 .top(px(-11.))
707 .text_size(px(9.))707 .text_size(px(9.))
708- .text_color(rgb(FG_SECONDARY))708+ .text_color(rgb(FG_SECONDARY()))
709 .child(format!("{db:+.0}")),709 .child(format!("{db:+.0}")),
710 )710 )
711 }))711 }))
@@ -716,7 +716,7 @@ impl Player {
716 .top(relative(0.5))716 .top(relative(0.5))
717 .w_full()717 .w_full()
718 .h(px(1.))718 .h(px(1.))
719- .bg(rgb(BG_HOVER)),719+ .bg(rgb(BG_HOVER())),
720 )720 )
721 .child(eq_curve(self.eq_params.clone(), sample_rate))721 .child(eq_curve(self.eq_params.clone(), sample_rate))
722 .children(handles)722 .children(handles)
@@ -731,7 +731,7 @@ impl Player {
731 .w(px(24.))731 .w(px(24.))
732 .text_align(TextAlign::Center)732 .text_align(TextAlign::Center)
733 .text_size(px(9.))733 .text_size(px(9.))
734- .text_color(rgb(FG_SECONDARY))734+ .text_color(rgb(FG_SECONDARY()))
735 .child(label)735 .child(label)
736 }))736 }))
737 .child(737 .child(
@@ -740,7 +740,7 @@ impl Player {
740 .top(px(2.))740 .top(px(2.))
741 .left(px(4.))741 .left(px(4.))
742 .text_size(px(9.))742 .text_size(px(9.))
743- .text_color(rgb(FG_SECONDARY))743+ .text_color(rgb(FG_SECONDARY()))
744 .child(format!("+{EQ_GAIN_LIMIT:.0} dB")),744 .child(format!("+{EQ_GAIN_LIMIT:.0} dB")),
745 );745 );
746 // The bottom of the axis is not named: -12 dB would land in the same746 // The bottom of the axis is not named: -12 dB would land in the same
@@ -761,7 +761,7 @@ impl Player {
761 .flex()761 .flex()
762 .justify_center()762 .justify_center()
763 .items_center()763 .items_center()
764- .bg(rgba(SCRIM))764+ .bg(rgba(SCRIM()))
765 // Click away closes it, as on every card here.765 // Click away closes it, as on every card here.
766 .on_mouse_down(766 .on_mouse_down(
767 MouseButton::Left,767 MouseButton::Left,
@@ -793,7 +793,7 @@ impl Player {
793 .gap(px(2.))793 .gap(px(2.))
794 .p(px(12.))794 .p(px(12.))
795 .rounded(px(6.))795 .rounded(px(6.))
796- .bg(rgb(BG_RAISED))796+ .bg(rgb(BG_RAISED()))
797 .child(797 .child(
798 div()798 div()
799 .id("eq-card-rows")799 .id("eq-card-rows")
@@ -818,7 +818,7 @@ impl Player {
818 .flex_none()818 .flex_none()
819 .px(px(6.))819 .px(px(6.))
820 .text_size(px(11.))820 .text_size(px(11.))
821- .text_color(rgb(FG_SECONDARY))821+ .text_color(rgb(FG_SECONDARY()))
822 .child(self.notices.front().cloned().unwrap_or_else(|| {822 .child(self.notices.front().cloned().unwrap_or_else(|| {
823 "drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum; a click away or esc closes".into()823 "drag a handle, or a digit picks a band — ←→ moves it, ↑↓ its gain, shift+←→ its width; a adds, x removes, f flattens it, r all, s spectrum; a click away or esc closes".into()
824 })),824 })),
@@ -850,9 +850,9 @@ impl Player {
850 .items_center()850 .items_center()
851 .justify_center()851 .justify_center()
852 .rounded(px(3.))852 .rounded(px(3.))
853- .bg(rgb(BG_SELECTED))853+ .bg(rgb(BG_SELECTED()))
854 .cursor_pointer()854 .cursor_pointer()
855- .hover(|s| s.bg(rgb(BG_HOVER)))855+ .hover(|s| s.bg(rgb(BG_HOVER())))
856 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {856 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
857 for band in &mut this.eq_params.bands {857 for band in &mut this.eq_params.bands {
858 band.gain_db = 0.;858 band.gain_db = 0.;
@@ -874,9 +874,9 @@ impl Player {
874 .items_center()874 .items_center()
875 .justify_center()875 .justify_center()
876 .rounded(px(3.))876 .rounded(px(3.))
877- .bg(rgb(BG_PANEL))877+ .bg(rgb(BG_PANEL()))
878 .cursor_pointer()878 .cursor_pointer()
879- .hover(|s| s.bg(rgb(BG_HOVER)))879+ .hover(|s| s.bg(rgb(BG_HOVER())))
880 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {880 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
881 this.add_band(cx)881 this.add_band(cx)
882 }))882 }))
@@ -891,9 +891,9 @@ impl Player {
891 .items_center()891 .items_center()
892 .justify_center()892 .justify_center()
893 .rounded(px(3.))893 .rounded(px(3.))
894- .bg(rgb(BG_PANEL))894+ .bg(rgb(BG_PANEL()))
895 .cursor_pointer()895 .cursor_pointer()
896- .hover(|s| s.bg(rgb(BG_HOVER)))896+ .hover(|s| s.bg(rgb(BG_HOVER())))
897 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {897 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
898 this.remove_band(cx)898 this.remove_band(cx)
899 }))899 }))
@@ -913,11 +913,11 @@ impl Player {
913 .justify_center()913 .justify_center()
914 .rounded(px(3.))914 .rounded(px(3.))
915 .bg(rgb(match self.eq_spectrum {915 .bg(rgb(match self.eq_spectrum {
916- true => BG_SELECTED,916+ true => BG_SELECTED(),
917- false => BG_HOVER_DIM,917+ false => BG_HOVER_DIM(),
918 }))918 }))
919 .cursor_pointer()919 .cursor_pointer()
920- .hover(|s| s.bg(rgb(BG_HOVER)))920+ .hover(|s| s.bg(rgb(BG_HOVER())))
921 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {921 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
922 this.eq_spectrum = !this.eq_spectrum;922 this.eq_spectrum = !this.eq_spectrum;
923 cx.notify();923 cx.notify();
@@ -943,8 +943,8 @@ impl Player {
943 .px(px(6.))943 .px(px(6.))
944 .text_size(px(10.))944 .text_size(px(10.))
945 .text_color(rgb(match below > 1. {945 .text_color(rgb(match below > 1. {
946- true => ACCENT_PRIMARY,946+ true => ACCENT_PRIMARY(),
947- false => FG_SECONDARY,947+ false => FG_SECONDARY(),
948 }))948 }))
949 .child(match below > 1. {949 .child(match below > 1. {
950 true => "more below — scroll the card",950 true => "more below — scroll the card",
@@ -988,9 +988,9 @@ impl Player {
988 .items_center()988 .items_center()
989 .justify_center()989 .justify_center()
990 .rounded(px(3.))990 .rounded(px(3.))
991- .bg(rgb(BG_PANEL))991+ .bg(rgb(BG_PANEL()))
992 .cursor_pointer()992 .cursor_pointer()
993- .hover(|s| s.bg(rgb(BG_HOVER)))993+ .hover(|s| s.bg(rgb(BG_HOVER())))
994 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {994 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
995 this.nudge_band(change, cx)995 this.nudge_band(change, cx)
996 }))996 }))
@@ -1045,9 +1045,9 @@ impl Player {
1045 .px(px(8.))1045 .px(px(8.))
1046 .items_center()1046 .items_center()
1047 .rounded(px(3.))1047 .rounded(px(3.))
1048- .bg(rgb(BG_PANEL))1048+ .bg(rgb(BG_PANEL()))
1049 .cursor_pointer()1049 .cursor_pointer()
1050- .hover(|s| s.bg(rgb(BG_HOVER)))1050+ .hover(|s| s.bg(rgb(BG_HOVER())))
1051 .on_click(1051 .on_click(
1052 cx.listener(|this, _: &ClickEvent, _, cx| {1052 cx.listener(|this, _: &ClickEvent, _, cx| {
1053 this.nudge_band(|b| b.gain_db = 0., cx)1053 this.nudge_band(|b| b.gain_db = 0., cx)
@@ -1088,8 +1088,8 @@ impl Player {
1088 .px(px(6.))1088 .px(px(6.))
1089 .rounded(px(3.))1089 .rounded(px(3.))
1090 .cursor_pointer()1090 .cursor_pointer()
1091- .when(picked, |d| d.bg(rgb(BG_SELECTED)))1091+ .when(picked, |d| d.bg(rgb(BG_SELECTED())))
1092- .hover(|s| s.bg(rgb(BG_HOVER)))1092+ .hover(|s| s.bg(rgb(BG_HOVER())))
1093 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {1093 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
1094 this.color_band = i;1094 this.color_band = i;
1095 cx.notify();1095 cx.notify();
@@ -1124,13 +1124,13 @@ impl Player {
1124 .w_full()1124 .w_full()
1125 .h(px(4.))1125 .h(px(4.))
1126 .rounded(px(2.))1126 .rounded(px(2.))
1127- .bg(rgb(BG_PANEL))1127+ .bg(rgb(BG_PANEL()))
1128 .child(1128 .child(
1129 div()1129 div()
1130 .h_full()1130 .h_full()
1131 .w(relative(frac))1131 .w(relative(frac))
1132 .rounded(px(2.))1132 .rounded(px(2.))
1133- .bg(rgb(ACCENT_PRIMARY)),1133+ .bg(rgb(ACCENT_PRIMARY())),
1134 ),1134 ),
1135 ),1135 ),
1136 )1136 )
@@ -1138,7 +1138,7 @@ impl Player {
1138 div()1138 div()
1139 .w(px(44.))1139 .w(px(44.))
1140 .text_size(px(11.))1140 .text_size(px(11.))
1141- .text_color(rgb(FG_SECONDARY))1141+ .text_color(rgb(FG_SECONDARY()))
1142 .child(format!("{value:.2}")),1142 .child(format!("{value:.2}")),
1143 )1143 )
1144 })1144 })
@@ -1148,7 +1148,7 @@ impl Player {
1148 .flex()1148 .flex()
1149 .justify_center()1149 .justify_center()
1150 .items_center()1150 .items_center()
1151- .bg(rgba(SCRIM))1151+ .bg(rgba(SCRIM()))
1152 // Click away closes it, as on every card here.1152 // Click away closes it, as on every card here.
1153 .on_mouse_down(1153 .on_mouse_down(
1154 MouseButton::Left,1154 MouseButton::Left,
@@ -1168,7 +1168,7 @@ impl Player {
1168 .gap(px(2.))1168 .gap(px(2.))
1169 .p(px(12.))1169 .p(px(12.))
1170 .rounded(px(6.))1170 .rounded(px(6.))
1171- .bg(rgb(BG_RAISED))1171+ .bg(rgb(BG_RAISED()))
1172 .child(div().flex_none().px(px(6.)).child(format!(1172 .child(div().flex_none().px(px(6.)).child(format!(
1173 "Colour — {} clip {}",1173 "Colour — {} clip {}",
1174 lane.label(),1174 lane.label(),
@@ -1179,7 +1179,7 @@ impl Player {
1179 .flex_none()1179 .flex_none()
1180 .px(px(6.))1180 .px(px(6.))
1181 .text_size(px(11.))1181 .text_size(px(11.))
1182- .text_color(rgb(FG_SECONDARY))1182+ .text_color(rgb(FG_SECONDARY()))
1183 .child(1183 .child(
1184 "drag a bar, or ↑↓ picks one and ←→ moves it, r resets — a click away or esc closes",1184 "drag a bar, or ↑↓ picks one and ←→ moves it, r resets — a click away or esc closes",
1185 ),1185 ),
@@ -1193,7 +1193,7 @@ impl Player {
1193 .flex_none()1193 .flex_none()
1194 .h(px(HIST_H))1194 .h(px(HIST_H))
1195 .rounded(px(3.))1195 .rounded(px(3.))
1196- .bg(rgb(BG_HOVER_DIM))1196+ .bg(rgb(BG_HOVER_DIM()))
1197 .relative()1197 .relative()
1198 .child(hist_curves(self.histogram)),1198 .child(hist_curves(self.histogram)),
1199 )1199 )
@@ -1207,9 +1207,9 @@ impl Player {
1207 .items_center()1207 .items_center()
1208 .justify_center()1208 .justify_center()
1209 .rounded(px(3.))1209 .rounded(px(3.))
1210- .bg(rgb(BG_SELECTED))1210+ .bg(rgb(BG_SELECTED()))
1211 .cursor_pointer()1211 .cursor_pointer()
1212- .hover(|s| s.bg(rgb(BG_HOVER)))1212+ .hover(|s| s.bg(rgb(BG_HOVER())))
1213 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {1213 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
1214 this.set_color(ColorParams::default(), cx);1214 this.set_color(ColorParams::default(), cx);
1215 }))1215 }))
@@ -1249,11 +1249,11 @@ impl Player {
1249 .justify_center()1249 .justify_center()
1250 .rounded(px(3.))1250 .rounded(px(3.))
1251 .bg(rgb(match at == speed {1251 .bg(rgb(match at == speed {
1252- true => BG_SELECTED,1252+ true => BG_SELECTED(),
1253- false => BG_PANEL,1253+ false => BG_PANEL(),
1254 }))1254 }))
1255 .cursor_pointer()1255 .cursor_pointer()
1256- .hover(|s| s.bg(rgb(BG_HOVER)))1256+ .hover(|s| s.bg(rgb(BG_HOVER())))
1257 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {1257 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
1258 this.set_speed(at, cx);1258 this.set_speed(at, cx);
1259 }))1259 }))
@@ -1265,7 +1265,7 @@ impl Player {
1265 .flex()1265 .flex()
1266 .justify_center()1266 .justify_center()
1267 .items_center()1267 .items_center()
1268- .bg(rgba(SCRIM))1268+ .bg(rgba(SCRIM()))
1269 // Click away closes it, as on every card here.1269 // Click away closes it, as on every card here.
1270 .on_mouse_down(1270 .on_mouse_down(
1271 MouseButton::Left,1271 MouseButton::Left,
@@ -1285,7 +1285,7 @@ impl Player {
1285 .gap(px(6.))1285 .gap(px(6.))
1286 .p(px(12.))1286 .p(px(12.))
1287 .rounded(px(6.))1287 .rounded(px(6.))
1288- .bg(rgb(BG_RAISED))1288+ .bg(rgb(BG_RAISED()))
1289 .child(div().flex_none().px(px(6.)).child(format!(1289 .child(div().flex_none().px(px(6.)).child(format!(
1290 "Speed (tape) — {} clip {}",1290 "Speed (tape) — {} clip {}",
1291 lane.label(),1291 lane.label(),
@@ -1296,7 +1296,7 @@ impl Player {
1296 .flex_none()1296 .flex_none()
1297 .px(px(6.))1297 .px(px(6.))
1298 .text_size(px(11.))1298 .text_size(px(11.))
1299- .text_color(rgb(FG_SECONDARY))1299+ .text_color(rgb(FG_SECONDARY()))
1300 .child(1300 .child(
1301 "drag the bar or ←→ moves it, r is 1.00x — the pitch moves with the rate; a click away or esc closes",1301 "drag the bar or ←→ moves it, r is 1.00x — the pitch moves with the rate; a click away or esc closes",
1302 ),1302 ),
@@ -1326,13 +1326,13 @@ impl Player {
1326 .w_full()1326 .w_full()
1327 .h(px(4.))1327 .h(px(4.))
1328 .rounded(px(2.))1328 .rounded(px(2.))
1329- .bg(rgb(BG_PANEL))1329+ .bg(rgb(BG_PANEL()))
1330 .child(1330 .child(
1331 div()1331 div()
1332 .h_full()1332 .h_full()
1333 .w(relative(frac))1333 .w(relative(frac))
1334 .rounded(px(2.))1334 .rounded(px(2.))
1335- .bg(rgb(ACCENT_PRIMARY)),1335+ .bg(rgb(ACCENT_PRIMARY())),
1336 ),1336 ),
1337 ),1337 ),
1338 )1338 )
@@ -1342,7 +1342,7 @@ impl Player {
1342 .flex_none()1342 .flex_none()
1343 .px(px(6.))1343 .px(px(6.))
1344 .text_size(px(11.))1344 .text_size(px(11.))
1345- .text_color(rgb(FG_SECONDARY))1345+ .text_color(rgb(FG_SECONDARY()))
1346 // What the choice *is*, in the numbers the1346 // What the choice *is*, in the numbers the
1347 // timeline is measured in: the source range1347 // timeline is measured in: the source range
1348 // never moves, the room it takes does.1348 // never moves, the room it takes does.
@@ -1414,16 +1414,16 @@ impl Player {
1414 .px(px(6.))1414 .px(px(6.))
1415 .rounded(px(3.))1415 .rounded(px(3.))
1416 .bg(rgb(match n == self.mix_field {1416 .bg(rgb(match n == self.mix_field {
1417- true => BG_SELECTED,1417+ true => BG_SELECTED(),
1418- false => BG_PANEL,1418+ false => BG_PANEL(),
1419 }))1419 }))
1420 .cursor_pointer()1420 .cursor_pointer()
1421- .hover(|s| s.bg(rgb(BG_HOVER)))1421+ .hover(|s| s.bg(rgb(BG_HOVER())))
1422 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {1422 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
1423 this.mix_field = n;1423 this.mix_field = n;
1424 cx.notify();1424 cx.notify();
1425 }))1425 }))
1426- .child(div().text_color(rgb(FG_SECONDARY)).child(label))1426+ .child(div().text_color(rgb(FG_SECONDARY())).child(label))
1427 .child(1427 .child(
1428 div()1428 div()
1429 .flex()1429 .flex()
@@ -1440,9 +1440,9 @@ impl Player {
1440 .items_center()1440 .items_center()
1441 .justify_center()1441 .justify_center()
1442 .rounded(px(3.))1442 .rounded(px(3.))
1443- .bg(rgb(BG_PANEL))1443+ .bg(rgb(BG_PANEL()))
1444 .cursor_pointer()1444 .cursor_pointer()
1445- .hover(|s| s.bg(rgb(BG_HOVER)))1445+ .hover(|s| s.bg(rgb(BG_HOVER())))
1446 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {1446 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
1447 // Picked as well as moved, the silence1447 // Picked as well as moved, the silence
1448 // card's rule: the row a press lands on1448 // card's rule: the row a press lands on
@@ -1463,7 +1463,7 @@ impl Player {
1463 .flex()1463 .flex()
1464 .justify_center()1464 .justify_center()
1465 .items_center()1465 .items_center()
1466- .bg(rgba(SCRIM))1466+ .bg(rgba(SCRIM()))
1467 // Click away closes it, as on every card here.1467 // Click away closes it, as on every card here.
1468 .on_mouse_down(1468 .on_mouse_down(
1469 MouseButton::Left,1469 MouseButton::Left,
@@ -1484,7 +1484,7 @@ impl Player {
1484 .gap(px(6.))1484 .gap(px(6.))
1485 .p(px(12.))1485 .p(px(12.))
1486 .rounded(px(6.))1486 .rounded(px(6.))
1487- .bg(rgb(BG_RAISED))1487+ .bg(rgb(BG_RAISED()))
1488 .child(1488 .child(
1489 div()1489 div()
1490 .flex_none()1490 .flex_none()
@@ -1496,7 +1496,7 @@ impl Player {
1496 .flex_none()1496 .flex_none()
1497 .px(px(6.))1497 .px(px(6.))
1498 .text_size(px(11.))1498 .text_size(px(11.))
1499- .text_color(rgb(FG_SECONDARY))1499+ .text_color(rgb(FG_SECONDARY()))
1500 .child(1500 .child(
1501 "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — a track fader moves everything on that track; a click away or esc closes",1501 "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — a track fader moves everything on that track; a click away or esc closes",
1502 ),1502 ),
@@ -1515,7 +1515,7 @@ impl Player {
1515 .flex_none()1515 .flex_none()
1516 .px(px(6.))1516 .px(px(6.))
1517 .text_size(px(11.))1517 .text_size(px(11.))
1518- .text_color(rgb(FG_SECONDARY))1518+ .text_color(rgb(FG_SECONDARY()))
1519 // What the choice *is*: the limiter's own line,1519 // What the choice *is*: the limiter's own line,
1520 // because "on" alone says nothing about what it1520 // because "on" alone says nothing about what it
1521 // does to a mix that never reaches the ceiling.1521 // does to a mix that never reaches the ceiling.
@@ -1601,16 +1601,16 @@ impl Player {
1601 .px(px(6.))1601 .px(px(6.))
1602 .rounded(px(3.))1602 .rounded(px(3.))
1603 .bg(rgb(match n == self.silence_field {1603 .bg(rgb(match n == self.silence_field {
1604- true => BG_SELECTED,1604+ true => BG_SELECTED(),
1605- false => BG_PANEL,1605+ false => BG_PANEL(),
1606 }))1606 }))
1607 .cursor_pointer()1607 .cursor_pointer()
1608- .hover(|s| s.bg(rgb(BG_HOVER)))1608+ .hover(|s| s.bg(rgb(BG_HOVER())))
1609 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {1609 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
1610 this.silence_field = n;1610 this.silence_field = n;
1611 cx.notify();1611 cx.notify();
1612 }))1612 }))
1613- .child(div().text_color(rgb(FG_SECONDARY)).child(label))1613+ .child(div().text_color(rgb(FG_SECONDARY())).child(label))
1614 // The value and the two steps that move it. Every other1614 // The value and the two steps that move it. Every other
1615 // card has something to drag or press; this one had the1615 // card has something to drag or press; this one had the
1616 // arrow keys and nothing else, so a row was a setting a1616 // arrow keys and nothing else, so a row was a setting a
@@ -1633,9 +1633,9 @@ impl Player {
1633 .items_center()1633 .items_center()
1634 .justify_center()1634 .justify_center()
1635 .rounded(px(3.))1635 .rounded(px(3.))
1636- .bg(rgb(BG_PANEL))1636+ .bg(rgb(BG_PANEL()))
1637 .cursor_pointer()1637 .cursor_pointer()
1638- .hover(|s| s.bg(rgb(BG_HOVER)))1638+ .hover(|s| s.bg(rgb(BG_HOVER())))
1639 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {1639 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
1640 // Picked as well as moved: the row a1640 // Picked as well as moved: the row a
1641 // press lands on is the row the arrows1641 // press lands on is the row the arrows
@@ -1664,11 +1664,11 @@ impl Player {
1664 .justify_center()1664 .justify_center()
1665 .rounded(px(3.))1665 .rounded(px(3.))
1666 .bg(rgb(match found {1666 .bg(rgb(match found {
1667- 0 => BG_PANEL,1667+ 0 => BG_PANEL(),
1668- _ => BG_SELECTED,1668+ _ => BG_SELECTED(),
1669 }))1669 }))
1670 .cursor_pointer()1670 .cursor_pointer()
1671- .hover(|s| s.bg(rgb(BG_HOVER)))1671+ .hover(|s| s.bg(rgb(BG_HOVER())))
1672 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| act(this, cx)))1672 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| act(this, cx)))
1673 .child(text)1673 .child(text)
1674 };1674 };
@@ -1680,7 +1680,7 @@ impl Player {
1680 .pt(px(HEADER_H + 8.))1680 .pt(px(HEADER_H + 8.))
1681 // Light enough to read the lanes and the marks on them through:1681 // Light enough to read the lanes and the marks on them through:
1682 // the preview is the point of this card.1682 // the preview is the point of this card.
1683- .bg(rgba(SCRIM_LIGHT))1683+ .bg(rgba(SCRIM_LIGHT()))
1684 // Click away closes it, as on every card here -- and the marks1684 // Click away closes it, as on every card here -- and the marks
1685 // go with it, which is what makes this one a call and not a flag.1685 // go with it, which is what makes this one a call and not a flag.
1686 .on_mouse_down(1686 .on_mouse_down(
@@ -1701,7 +1701,7 @@ impl Player {
1701 .gap(px(6.))1701 .gap(px(6.))
1702 .p(px(12.))1702 .p(px(12.))
1703 .rounded(px(6.))1703 .rounded(px(6.))
1704- .bg(rgb(BG_RAISED))1704+ .bg(rgb(BG_RAISED()))
1705 .child(div().flex_none().px(px(6.)).child(format!(1705 .child(div().flex_none().px(px(6.)).child(format!(
1706 "Silences — {} clip {}",1706 "Silences — {} clip {}",
1707 lane.label(),1707 lane.label(),
@@ -1712,7 +1712,7 @@ impl Player {
1712 .flex_none()1712 .flex_none()
1713 .px(px(6.))1713 .px(px(6.))
1714 .text_size(px(11.))1714 .text_size(px(11.))
1715- .text_color(rgb(FG_SECONDARY))1715+ .text_color(rgb(FG_SECONDARY()))
1716 .child(1716 .child(
1717 "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — the marks on the lane are what would go; a click away or esc closes",1717 "− and + move a setting, or ↑↓ picks one and ←→ moves it (hold to run it) — the marks on the lane are what would go; a click away or esc closes",
1718 ),1718 ),
@@ -1723,8 +1723,8 @@ impl Player {
1723 .flex_none()1723 .flex_none()
1724 .px(px(6.))1724 .px(px(6.))
1725 .text_color(rgb(match (&self.silence_scan, found) {1725 .text_color(rgb(match (&self.silence_scan, found) {
1726- (None, 1..) => ACCENT_PRIMARY,1726+ (None, 1..) => ACCENT_PRIMARY(),
1727- _ => FG_SECONDARY,1727+ _ => FG_SECONDARY(),
1728 }))1728 }))
1729 .child(status),1729 .child(status),
1730 )1730 )
crates/app/src/ui/inspector.rsmodified+23 -23
@@ -42,9 +42,9 @@ impl Player {
42 .relative()42 .relative()
43 .flex()43 .flex()
44 .flex_col()44 .flex_col()
45- .bg(rgb(BG_PANEL))45+ .bg(rgb(BG_PANEL()))
46 .border_l_1()46 .border_l_1()
47- .border_color(rgb(STROKE_DIVIDER))47+ .border_color(rgb(STROKE_DIVIDER()))
48 .child(section_head("Inspector"))48 .child(section_head("Inspector"))
49 .child(49 .child(
50 div()50 div()
@@ -71,8 +71,8 @@ impl Player {
71 .px(px(8.))71 .px(px(8.))
72 .text_size(px(10.))72 .text_size(px(10.))
73 .text_color(rgb(match below > 1. {73 .text_color(rgb(match below > 1. {
74- true => ACCENT_PRIMARY,74+ true => ACCENT_PRIMARY(),
75- false => FG_SECONDARY,75+ false => FG_SECONDARY(),
76 }))76 }))
77 .child(match below > 1. {77 .child(match below > 1. {
78 true => "more below — scroll the inspector",78 true => "more below — scroll the inspector",
@@ -124,14 +124,14 @@ impl Player {
124 .gap(px(6.))124 .gap(px(6.))
125 .p(px(8.))125 .p(px(8.))
126 .rounded(px(4.))126 .rounded(px(4.))
127- .bg(rgb(BG_HOVER_DIM))127+ .bg(rgb(BG_HOVER_DIM()))
128 .child(128 .child(
129 div()129 div()
130 .flex_none()130 .flex_none()
131 .truncate()131 .truncate()
132 .text_color(rgb(match picked.is_some() {132 .text_color(rgb(match picked.is_some() {
133- true => FG_PRIMARY,133+ true => FG_PRIMARY(),
134- false => FG_SECONDARY,134+ false => FG_SECONDARY(),
135 }))135 }))
136 // The kind's own colour, the same one its clip wears on the136 // The kind's own colour, the same one its clip wears on the
137 // timeline: the panel and the box are about the same thing.137 // timeline: the panel and the box are about the same thing.
@@ -146,7 +146,7 @@ impl Player {
146 div()146 div()
147 .flex_none()147 .flex_none()
148 .text_size(px(11.))148 .text_size(px(11.))
149- .text_color(rgb(FG_SECONDARY))149+ .text_color(rgb(FG_SECONDARY()))
150 .child(detail),150 .child(detail),
151 )151 )
152 .child(152 .child(
@@ -157,7 +157,7 @@ impl Player {
157 .child(self.action_control(157 .child(self.action_control(
158 "inspect-speed",158 "inspect-speed",
159 0.,159 0.,
160- BG_RAISED,160+ BG_RAISED(),
161 None,161 None,
162 "Speed",162 "Speed",
163 "how fast this clip and its group play",163 "how fast this clip and its group play",
@@ -167,7 +167,7 @@ impl Player {
167 .child(self.action_control(167 .child(self.action_control(
168 "inspect-color",168 "inspect-color",
169 0.,169 0.,
170- BG_RAISED,170+ BG_RAISED(),
171 None,171 None,
172 "Colour",172 "Colour",
173 "exposure, contrast, saturation and temperature",173 "exposure, contrast, saturation and temperature",
@@ -177,7 +177,7 @@ impl Player {
177 .child(self.action_control(177 .child(self.action_control(
178 "inspect-eq",178 "inspect-eq",
179 0.,179 0.,
180- BG_RAISED,180+ BG_RAISED(),
181 None,181 None,
182 "Equalizer",182 "Equalizer",
183 "the bands this clip's sound is filtered through",183 "the bands this clip's sound is filtered through",
@@ -187,7 +187,7 @@ impl Player {
187 .child(self.action_control(187 .child(self.action_control(
188 "inspect-silence",188 "inspect-silence",
189 0.,189 0.,
190- BG_RAISED,190+ BG_RAISED(),
191 None,191 None,
192 "Silence",192 "Silence",
193 "finds the quiet stretches and cuts or speeds them",193 "finds the quiet stretches and cuts or speeds them",
@@ -197,7 +197,7 @@ impl Player {
197 .child(self.action_control(197 .child(self.action_control(
198 "inspect-fit",198 "inspect-fit",
199 0.,199 0.,
200- BG_RAISED,200+ BG_RAISED(),
201 None,201 None,
202 "Fit",202 "Fit",
203 "how this picture is placed on the project canvas",203 "how this picture is placed on the project canvas",
@@ -207,7 +207,7 @@ impl Player {
207 .child(self.action_control(207 .child(self.action_control(
208 "inspect-delete",208 "inspect-delete",
209 0.,209 0.,
210- BG_RAISED,210+ BG_RAISED(),
211 None,211 None,
212 "Delete",212 "Delete",
213 "takes this clip off the timeline",213 "takes this clip off the timeline",
@@ -229,12 +229,12 @@ impl Player {
229 .gap(px(6.))229 .gap(px(6.))
230 .p(px(8.))230 .p(px(8.))
231 .rounded(px(4.))231 .rounded(px(4.))
232- .bg(rgb(BG_HOVER_DIM))232+ .bg(rgb(BG_HOVER_DIM()))
233 .child(233 .child(
234 div()234 div()
235 .flex_none()235 .flex_none()
236 .text_size(px(11.))236 .text_size(px(11.))
237- .text_color(rgb(FG_SECONDARY))237+ .text_color(rgb(FG_SECONDARY()))
238 .child("PROJECT"),238 .child("PROJECT"),
239 )239 )
240 .child(240 .child(
@@ -245,7 +245,7 @@ impl Player {
245 .child(self.action_control(245 .child(self.action_control(
246 "resolution",246 "resolution",
247 ZOOM_SLOT_W,247 ZOOM_SLOT_W,
248- BG_RAISED,248+ BG_RAISED(),
249 None,249 None,
250 resolution.map_or_else(|| "Size".to_string(), |(_, h)| format!("{h}p")),250 resolution.map_or_else(|| "Size".to_string(), |(_, h)| format!("{h}p")),
251 "the canvas every clip is composed onto, and the size the export comes out at",251 "the canvas every clip is composed onto, and the size the export comes out at",
@@ -257,7 +257,7 @@ impl Player {
257 .child(self.action_control(257 .child(self.action_control(
258 "fps",258 "fps",
259 ZOOM_SLOT_W,259 ZOOM_SLOT_W,
260- BG_RAISED,260+ BG_RAISED(),
261 None,261 None,
262 match self.session.is_some() {262 match self.session.is_some() {
263 true => format!("{} fps", fps_label(self.fps)),263 true => format!("{} fps", fps_label(self.fps)),
@@ -272,7 +272,7 @@ impl Player {
272 .child(self.action_control(272 .child(self.action_control(
273 "tonemap",273 "tonemap",
274 TONE_SLOT_W,274 TONE_SLOT_W,
275- BG_RAISED,275+ BG_RAISED(),
276 None,276 None,
277 match &self.session {277 match &self.session {
278 Some(session) => format!("HDR {}", tone_label(session.tone())),278 Some(session) => format!("HDR {}", tone_label(session.tone())),
@@ -287,7 +287,7 @@ impl Player {
287 .child(self.action_control(287 .child(self.action_control(
288 "inspect-mix",288 "inspect-mix",
289 0.,289 0.,
290- BG_RAISED,290+ BG_RAISED(),
291 None,291 None,
292 "Mix",292 "Mix",
293 "a fader per track and the limiter over the sum of them",293 "a fader per track and the limiter over the sum of them",
@@ -307,10 +307,10 @@ pub(crate) fn section_head(title: &'static str) -> impl IntoElement {
307 .flex()307 .flex()
308 .items_center()308 .items_center()
309 .px(px(8.))309 .px(px(8.))
310- .bg(rgb(BG_PANEL))310+ .bg(rgb(BG_PANEL()))
311 .border_b_1()311 .border_b_1()
312- .border_color(rgb(STROKE_DIVIDER))312+ .border_color(rgb(STROKE_DIVIDER()))
313 .text_size(px(11.))313 .text_size(px(11.))
314- .text_color(rgb(FG_SECONDARY))314+ .text_color(rgb(FG_SECONDARY()))
315 .child(title)315 .child(title)
316 }316 }
crates/app/src/ui/library.rsmodified+18 -18
@@ -127,10 +127,10 @@ impl Player {
127 .rounded(px(3.))127 .rounded(px(3.))
128 // A row that cannot be placed takes no click and no drag, and128 // A row that cannot be placed takes no click and no drag, and
129 // reads as unavailable rather than merely unlucky.129 // reads as unavailable rather than merely unlucky.
130- .when(!usable, |d| d.text_color(rgb(FG_SECONDARY)).opacity(0.55))130+ .when(!usable, |d| d.text_color(rgb(FG_SECONDARY())).opacity(0.55))
131 .when(usable, |d| {131 .when(usable, |d| {
132 d.cursor_pointer()132 d.cursor_pointer()
133- .hover(|s| s.bg(rgb(BG_HOVER)))133+ .hover(|s| s.bg(rgb(BG_HOVER())))
134 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {134 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
135 this.selected_asset = Some((path.clone(), stream));135 this.selected_asset = Some((path.clone(), stream));
136 cx.notify();136 cx.notify();
@@ -170,7 +170,7 @@ impl Player {
170 cx.notify();170 cx.notify();
171 }),171 }),
172 )172 )
173- .when(picked, |d| d.bg(rgb(BG_SELECTED)).border_1())173+ .when(picked, |d| d.bg(rgb(BG_SELECTED())).border_1())
174 .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())174 .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())
175 // Full height and hard against the edge: the tint reads as175 // Full height and hard against the edge: the tint reads as
176 // the lane's colour continuing into the list, not as a chip176 // the lane's colour continuing into the list, not as a chip
@@ -205,7 +205,7 @@ impl Player {
205 div()205 div()
206 .truncate()206 .truncate()
207 .text_size(px(10.))207 .text_size(px(10.))
208- .text_color(rgb(FG_SECONDARY))208+ .text_color(rgb(FG_SECONDARY()))
209 .child(under),209 .child(under),
210 ),210 ),
211 )211 )
@@ -220,7 +220,7 @@ impl Player {
220 .flex_col()220 .flex_col()
221 .gap(px(6.))221 .gap(px(6.))
222 .p(px(8.))222 .p(px(8.))
223- .bg(rgb(BG_PANEL))223+ .bg(rgb(BG_PANEL()))
224 // The column itself scrolls at a short window. Its five stacked224 // The column itself scrolls at a short window. Its five stacked
225 // things want 140 px and the 640x360 floor gives the region 136, so225 // things want 140 px and the 640x360 floor gives the region 136, so
226 // the list -- the only child that may shrink -- was being squeezed to226 // the list -- the only child that may shrink -- was being squeezed to
@@ -258,19 +258,19 @@ impl Player {
258 .rounded(px(3.))258 .rounded(px(3.))
259 .text_size(px(11.))259 .text_size(px(11.))
260 .text_color(rgb(match on {260 .text_color(rgb(match on {
261- true => FG_PRIMARY,261+ true => FG_PRIMARY(),
262- false => FG_SECONDARY,262+ false => FG_SECONDARY(),
263 }))263 }))
264 // One selection language everywhere: the264 // One selection language everywhere: the
265 // same stroke a picked clip and a picked265 // same stroke a picked clip and a picked
266 // row wear.266 // row wear.
267 .when(on, |d| {267 .when(on, |d| {
268- d.bg(rgb(BG_SELECTED))268+ d.bg(rgb(BG_SELECTED()))
269 .border_b_2()269 .border_b_2()
270- .border_color(rgb(STROKE_SELECTED))270+ .border_color(rgb(STROKE_SELECTED()))
271 })271 })
272 .cursor_pointer()272 .cursor_pointer()
273- .hover(|s| s.bg(rgb(BG_HOVER)))273+ .hover(|s| s.bg(rgb(BG_HOVER())))
274 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {274 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
275 this.library_tab = tab;275 this.library_tab = tab;
276 cx.notify();276 cx.notify();
@@ -294,8 +294,8 @@ impl Player {
294 // the rest of the time, is dimmed until something is294 // the rest of the time, is dimmed until something is
295 // imported. One live accent in the window either way.295 // imported. One live accent in the window either way.
296 match rows.is_empty() {296 match rows.is_empty() {
297- true => ACCENT_PRIMARY,297+ true => ACCENT_PRIMARY(),
298- false => BG_RAISED,298+ false => BG_RAISED(),
299 },299 },
300 None,300 None,
301 "Import",301 "Import",
@@ -321,7 +321,7 @@ impl Player {
321 d.child(321 d.child(
322 div()322 div()
323 .text_size(px(11.))323 .text_size(px(11.))
324- .text_color(rgb(FG_SECONDARY))324+ .text_color(rgb(FG_SECONDARY()))
325 .child(self.library_tab.empty()),325 .child(self.library_tab.empty()),
326 )326 )
327 })327 })
@@ -336,7 +336,7 @@ impl Player {
336 .child(control(336 .child(control(
337 "add-asset",337 "add-asset",
338 0.,338 0.,
339- BG_RAISED,339+ BG_RAISED(),
340 None,340 None,
341 "Add at playhead",341 "Add at playhead",
342 match self.selected_asset {342 match self.selected_asset {
@@ -442,7 +442,7 @@ impl Player {
442 .min_w(px(0.))442 .min_w(px(0.))
443 .truncate()443 .truncate()
444 .text_size(px(11.))444 .text_size(px(11.))
445- .text_color(rgb(FG_SECONDARY))445+ .text_color(rgb(FG_SECONDARY()))
446 .child(value),446 .child(value),
447 )447 )
448 .into_any_element(),448 .into_any_element(),
@@ -463,13 +463,13 @@ impl Player {
463 div()463 div()
464 .min_w(px(0.))464 .min_w(px(0.))
465 .truncate()465 .truncate()
466- .text_color(rgb(FG_SECONDARY))466+ .text_color(rgb(FG_SECONDARY()))
467 .child(refusal.why().unwrap_or_else(|| item.hint())),467 .child(refusal.why().unwrap_or_else(|| item.hint())),
468 )468 )
469 .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed())469 .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed())
470 .when(enabled, |d| {470 .when(enabled, |d| {
471 d.cursor_pointer()471 d.cursor_pointer()
472- .hover(|s| s.bg(rgb(BG_HOVER)))472+ .hover(|s| s.bg(rgb(BG_HOVER())))
473 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {473 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
474 this.act_on_row(item, cx);474 this.act_on_row(item, cx);
475 }))475 }))
@@ -512,7 +512,7 @@ impl Player {
512 .flex_col()512 .flex_col()
513 .p(px(MENU_PAD))513 .p(px(MENU_PAD))
514 .rounded(px(6.))514 .rounded(px(6.))
515- .bg(rgb(BG_RAISED))515+ .bg(rgb(BG_RAISED()))
516 // Painted after the scrim, so this listener runs first516 // Painted after the scrim, so this listener runs first
517 // and a press meant for an item never closes the menu517 // and a press meant for an item never closes the menu
518 // out from under its own click (`context_card`).518 // out from under its own click (`context_card`).
crates/app/src/ui/overlays.rsmodified+36 -31
@@ -41,7 +41,7 @@ impl Player {
41 .gap(px(4.))41 .gap(px(4.))
42 .px(px(12.))42 .px(px(12.))
43 .py(px(6.))43 .py(px(6.))
44- .bg(rgb(BG_RAISED))44+ .bg(rgb(BG_RAISED()))
45 .child(45 .child(
46 div()46 div()
47 .flex()47 .flex()
@@ -55,7 +55,7 @@ impl Player {
55 0.,55 0.,
56 // The ordinary plane -- the accent is Export's, and56 // The ordinary plane -- the accent is Export's, and
57 // a way out of a read is not the primary action.57 // a way out of a read is not the primary action.
58- BG_RAISED,58+ BG_RAISED(),
59 None,59 None,
60 "Cancel",60 "Cancel",
61 "stops this file and anything queued behind it; the read already \61 "stops this file and anything queued behind it; the read already \
@@ -70,7 +70,7 @@ impl Player {
70 .relative()70 .relative()
71 .w_full()71 .w_full()
72 .h(px(2.))72 .h(px(2.))
73- .bg(rgb(BG_HOVER))73+ .bg(rgb(BG_HOVER()))
74 .child(74 .child(
75 div()75 div()
76 .absolute()76 .absolute()
@@ -82,7 +82,7 @@ impl Player {
82 // paint outside the track.82 // paint outside the track.
83 .w(relative((at + SWEEP).min(1.) - at.max(0.)))83 .w(relative((at + SWEEP).min(1.) - at.max(0.)))
84 .h(px(2.))84 .h(px(2.))
85- .bg(rgb(ACCENT_PRIMARY)),85+ .bg(rgb(ACCENT_PRIMARY())),
86 ),86 ),
87 ),87 ),
88 )88 )
@@ -99,7 +99,7 @@ impl Player {
99 .flex_none()99 .flex_none()
100 .px(px(12.))100 .px(px(12.))
101 .py(px(6.))101 .py(px(6.))
102- .bg(rgb(BG_RAISED))102+ .bg(rgb(BG_RAISED()))
103 .child(line),103 .child(line),
104 )104 )
105 }105 }
@@ -159,14 +159,14 @@ impl Player {
159 .gap(px(12.))159 .gap(px(12.))
160 .px(px(12.))160 .px(px(12.))
161 .py(px(6.))161 .py(px(6.))
162- .bg(rgb(BG_RAISED))162+ .bg(rgb(BG_RAISED()))
163 // The tone is a stripe down the leading edge rather than the163 // The tone is a stripe down the leading edge rather than the
164 // whole bar's colour: a full red bar at every refusal is an164 // whole bar's colour: a full red bar at every refusal is an
165 // alarm, and most of these are answers.165 // alarm, and most of these are answers.
166 .border_l(px(3.))166 .border_l(px(3.))
167 .border_color(rgb(tone))167 .border_color(rgb(tone))
168 .cursor_pointer()168 .cursor_pointer()
169- .hover(|s| s.bg(rgb(BG_HOVER)))169+ .hover(|s| s.bg(rgb(BG_HOVER())))
170 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {170 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
171 // Another process starting: off the UI thread, and it171 // Another process starting: off the UI thread, and it
172 // outlives the notice it was asked from.172 // outlives the notice it was asked from.
@@ -190,7 +190,7 @@ impl Player {
190 div()190 div()
191 .flex_none()191 .flex_none()
192 .text_size(px(11.))192 .text_size(px(11.))
193- .text_color(rgb(FG_SECONDARY))193+ .text_color(rgb(FG_SECONDARY()))
194 .child(hint),194 .child(hint),
195 ),195 ),
196 )196 )
@@ -266,7 +266,7 @@ impl Player {
266 .px(px(6.))266 .px(px(6.))
267 .pt(px(4.))267 .pt(px(4.))
268 .text_size(px(11.))268 .text_size(px(11.))
269- .text_color(rgb(FG_SECONDARY))269+ .text_color(rgb(FG_SECONDARY()))
270 .child(category.label())270 .child(category.label())
271 .into_any_element(),271 .into_any_element(),
272 KeyRow::Act(action) => {272 KeyRow::Act(action) => {
@@ -276,7 +276,7 @@ impl Player {
276 let refusal = self.enable(action, None);276 let refusal = self.enable(action, None);
277 let out = out.clone();277 let out = out.clone();
278 row()278 row()
279- .when(capturing, |d| d.bg(rgb(BG_SELECTED)))279+ .when(capturing, |d| d.bg(rgb(BG_SELECTED())))
280 .child(280 .child(
281 div()281 div()
282 .id(("do", i))282 .id(("do", i))
@@ -303,7 +303,7 @@ impl Player {
303 })303 })
304 .when(!refusal.yes(), |d| d.opacity(0.4).cursor_not_allowed())304 .when(!refusal.yes(), |d| d.opacity(0.4).cursor_not_allowed())
305 .when(refusal.yes(), |d| {305 .when(refusal.yes(), |d| {
306- d.cursor_pointer().hover(|s| s.bg(rgb(BG_HOVER))).on_click(306+ d.cursor_pointer().hover(|s| s.bg(rgb(BG_HOVER()))).on_click(
307 cx.listener(move |this, _: &ClickEvent, _, cx| {307 cx.listener(move |this, _: &ClickEvent, _, cx| {
308 // The card goes first: several of308 // The card goes first: several of
309 // these open a card of their own,309 // these open a card of their own,
@@ -329,14 +329,14 @@ impl Player {
329 .min_h(px(KEYS_ROW_H))329 .min_h(px(KEYS_ROW_H))
330 .items_center()330 .items_center()
331 .cursor_pointer()331 .cursor_pointer()
332- .hover(|s| s.bg(rgb(BG_HOVER)))332+ .hover(|s| s.bg(rgb(BG_HOVER())))
333 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {333 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
334 this.rebinding = Some(action);334 this.rebinding = Some(action);
335 cx.notify();335 cx.notify();
336 }))336 }))
337 .child(if capturing {337 .child(if capturing {
338 div()338 div()
339- .text_color(rgb(FG_SECONDARY))339+ .text_color(rgb(FG_SECONDARY()))
340 .child(format!("press a key — {out} cancels"))340 .child(format!("press a key — {out} cancels"))
341 } else {341 } else {
342 div().child(self.keymap.display(action))342 div().child(self.keymap.display(action))
@@ -349,7 +349,7 @@ impl Player {
349 row()349 row()
350 .child(f.label)350 .child(f.label)
351 // Dim, and no hover: this one is not a row you can click.351 // Dim, and no hover: this one is not a row you can click.
352- .child(div().text_color(rgb(FG_SECONDARY)).child(f.chord.clone()))352+ .child(div().text_color(rgb(FG_SECONDARY())).child(f.chord.clone()))
353 .into_any_element()353 .into_any_element()
354 }354 }
355 });355 });
@@ -363,7 +363,7 @@ impl Player {
363 // swallowed here so a button under the scrim cannot take it --363 // swallowed here so a button under the scrim cannot take it --
364 // and it closes the card on the way, which is the pointer's exit364 // and it closes the card on the way, which is the pointer's exit
365 // from every card here ([`Player::close_card`]).365 // from every card here ([`Player::close_card`]).
366- .bg(rgba(SCRIM))366+ .bg(rgba(SCRIM()))
367 .on_mouse_down(367 .on_mouse_down(
368 MouseButton::Left,368 MouseButton::Left,
369 cx.listener(|this, _: &MouseDownEvent, _, cx| {369 cx.listener(|this, _: &MouseDownEvent, _, cx| {
@@ -381,7 +381,7 @@ impl Player {
381 .gap(px(2.))381 .gap(px(2.))
382 .p(px(12.))382 .p(px(12.))
383 .rounded(px(6.))383 .rounded(px(6.))
384- .bg(rgb(BG_RAISED))384+ .bg(rgb(BG_RAISED()))
385 // Title and instruction are two children, never one385 // Title and instruction are two children, never one
386 // wrapping line: a fixed-height slot whose text wrapped386 // wrapping line: a fixed-height slot whose text wrapped
387 // painted its second line over the first row.387 // painted its second line over the first row.
@@ -399,7 +399,7 @@ impl Player {
399 .flex_none()399 .flex_none()
400 .px(px(6.))400 .px(px(6.))
401 .text_size(px(11.))401 .text_size(px(11.))
402- .text_color(rgb(FG_SECONDARY))402+ .text_color(rgb(FG_SECONDARY()))
403 .child(403 .child(
404 self.notices404 self.notices
405 .front()405 .front()
@@ -420,7 +420,7 @@ impl Player {
420 .flex_none()420 .flex_none()
421 .px(px(6.))421 .px(px(6.))
422 .text_size(px(11.))422 .text_size(px(11.))
423- .text_color(rgb(FG_SECONDARY))423+ .text_color(rgb(FG_SECONDARY()))
424 .child(search),424 .child(search),
425 )425 )
426 // Capped and scrolling rather than as tall as the action426 // Capped and scrolling rather than as tall as the action
@@ -440,7 +440,7 @@ impl Player {
440 // list with more above it.440 // list with more above it.
441 .mt(px(4.))441 .mt(px(4.))
442 .border_t_1()442 .border_t_1()
443- .border_color(rgb(BG_PANEL))443+ .border_color(rgb(BG_PANEL()))
444 .pt(px(4.))444 .pt(px(4.))
445 .overflow_y_scroll()445 .overflow_y_scroll()
446 // The wheel's offset and the arrow keys' are446 // The wheel's offset and the arrow keys' are
@@ -523,7 +523,7 @@ impl Player {
523 // pair is 25 characters and has to fit beside523 // pair is 25 characters and has to fit beside
524 // its label inside `MENU_W`.524 // its label inside `MENU_W`.
525 .text_size(px(11.))525 .text_size(px(11.))
526- .text_color(rgb(FG_SECONDARY))526+ .text_color(rgb(FG_SECONDARY()))
527 .child(value),527 .child(value),
528 )528 )
529 .into_any_element(),529 .into_any_element(),
@@ -563,16 +563,16 @@ impl Player {
563 .min_w(px(0.))563 .min_w(px(0.))
564 .truncate()564 .truncate()
565 .text_size(px(11.))565 .text_size(px(11.))
566- .text_color(rgb(FG_SECONDARY))566+ .text_color(rgb(FG_SECONDARY()))
567 .child(why),567 .child(why),
568 None => div()568 None => div()
569- .text_color(rgb(FG_SECONDARY))569+ .text_color(rgb(FG_SECONDARY()))
570 .child(self.keymap.display(action)),570 .child(self.keymap.display(action)),
571 })571 })
572 .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed())572 .when(!enabled, |d| d.opacity(0.4).cursor_not_allowed())
573 .when(enabled, |d| {573 .when(enabled, |d| {
574 d.cursor_pointer()574 d.cursor_pointer()
575- .hover(|s| s.bg(rgb(BG_HOVER)))575+ .hover(|s| s.bg(rgb(BG_HOVER())))
576 .on_click(cx.listener(move |this, event: &ClickEvent, _, cx| {576 .on_click(cx.listener(move |this, event: &ClickEvent, _, cx| {
577 // Closed first: the action moves the very577 // Closed first: the action moves the very
578 // indices this menu is holding.578 // indices this menu is holding.
@@ -599,7 +599,7 @@ impl Player {
599 rows.push(599 rows.push(
600 row(rows.len())600 row(rows.len())
601 .cursor_pointer()601 .cursor_pointer()
602- .hover(|s| s.bg(rgb(BG_HOVER)))602+ .hover(|s| s.bg(rgb(BG_HOVER())))
603 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {603 .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
604 if let Some(menu) = &mut this.context_menu {604 if let Some(menu) = &mut this.context_menu {
605 menu.details = true;605 menu.details = true;
@@ -609,7 +609,7 @@ impl Player {
609 .child("Properties")609 .child("Properties")
610 // No stroke reaches this one, and a blank column would read610 // No stroke reaches this one, and a blank column would read
611 // as one that was forgotten.611 // as one that was forgotten.
612- .child(div().text_color(rgb(FG_SECONDARY)).child("…"))612+ .child(div().text_color(rgb(FG_SECONDARY())).child("…"))
613 .into_any_element(),613 .into_any_element(),
614 );614 );
615 }615 }
@@ -654,7 +654,7 @@ impl Player {
654 .flex_col()654 .flex_col()
655 .p(px(MENU_PAD))655 .p(px(MENU_PAD))
656 .rounded(px(6.))656 .rounded(px(6.))
657- .bg(rgb(BG_RAISED))657+ .bg(rgb(BG_RAISED()))
658 // Painted after the scrim, so this listener runs first658 // Painted after the scrim, so this listener runs first
659 // (gpui bubbles mouse events in reverse, window.rs:3705)659 // (gpui bubbles mouse events in reverse, window.rs:3705)
660 // and a press meant for an item never closes the menu660 // and a press meant for an item never closes the menu
@@ -716,12 +716,17 @@ impl Player {
716 .px(px(6.))716 .px(px(6.))
717 .rounded(px(3.))717 .rounded(px(3.))
718 .cursor_pointer()718 .cursor_pointer()
719- .hover(|s| s.bg(rgb(BG_HOVER)))719+ .hover(|s| s.bg(rgb(BG_HOVER())))
720 // The mark is a glyph as well as a highlight, like the720 // The mark is a glyph as well as a highlight, like the
721 // export card's rows: a background alone is gone under a721 // export card's rows: a background alone is gone under a
722 // hover and invisible to anyone who cannot tell the two722 // hover and invisible to anyone who cannot tell the two
723 // greys apart (WCAG 1.4.1).723 // greys apart (WCAG 1.4.1).
724- .when(picked, |d| d.bg(rgb(BG_SELECTED)))724+ .when(picked, |d| d.bg(rgb(BG_SELECTED())))
725+ // Where the keyboard is, said after the mark so the cursor
726+ // is visible on the picked row too -- and as a background,
727+ // not a border, because a row that grew a stroke would move
728+ // every row under it.
729+ .when(n == picker.sel, |d| d.bg(rgb(BG_HOVER())))
725 .child(730 .child(
726 div()731 div()
727 .flex()732 .flex()
@@ -742,8 +747,8 @@ impl Player {
742 // On the picked row the dim ink sits on the747 // On the picked row the dim ink sits on the
743 // highlight, where it is only 3.3:1 (WCAG 1.4.3).748 // highlight, where it is only 3.3:1 (WCAG 1.4.3).
744 .text_color(rgb(match picked {749 .text_color(rgb(match picked {
745- true => FG_PRIMARY,750+ true => FG_PRIMARY(),
746- false => FG_SECONDARY,751+ false => FG_SECONDARY(),
747 }))752 }))
748 .child(detail),753 .child(detail),
749 )754 )
@@ -788,7 +793,7 @@ impl Player {
788 .flex_col()793 .flex_col()
789 .p(px(MENU_PAD))794 .p(px(MENU_PAD))
790 .rounded(px(6.))795 .rounded(px(6.))
791- .bg(rgb(BG_RAISED))796+ .bg(rgb(BG_RAISED()))
792 // Painted after the scrim, so this listener runs first797 // Painted after the scrim, so this listener runs first
793 // and a press meant for a row never closes the list out798 // and a press meant for a row never closes the list out
794 // from under its own click (`context_card`).799 // from under its own click (`context_card`).
crates/app/src/ui/preview.rsmodified+2 -2
@@ -84,9 +84,9 @@ impl Player {
84 .max_w(relative(0.9))84 .max_w(relative(0.9))
85 .px(px(6.))85 .px(px(6.))
86 .rounded(px(3.))86 .rounded(px(3.))
87- .bg(rgba(SUB_SHADE))87+ .bg(rgba(SUB_SHADE()))
88 .text_size(px(SUB_TEXT))88 .text_size(px(SUB_TEXT))
89- .text_color(rgb(SUB_FG))89+ .text_color(rgb(SUB_FG()))
90 .text_align(TextAlign::Center)90 .text_align(TextAlign::Center)
91 // A line of the cue is a line on screen: the break the91 // A line of the cue is a line on screen: the break the
92 // parser kept is not whitespace to be re-flowed. What a92 // parser kept is not whitespace to be re-flowed. What a
crates/app/src/ui/theme.rsmodified+194 -22
@@ -7,30 +7,202 @@
7 //! can be swapped whole without touching a single element.7 //! can be swapped whole without touching a single element.
8 //!8 //!
9 //! Which is what the two modules below are for. Both families carry the same9 //! Which is what the two modules below are for. Both families carry the same
10-//! role names, so the switch between them is one `use` and no call site knows10+//! role names, so the switch between them is one field lookup and no call site
11-//! it happened -- and a role missing from either is a compile error rather than11+//! knows it happened -- and a role missing from either is a compile error
12-//! a region that quietly kept the old colour.12+//! rather than a region that quietly kept the old colour.
13 //!13 //!
14 //! * `cool` (default) -- near-black ground, cool neutral chrome, one cyan accent.14 //! * `cool` (default) -- near-black ground, cool neutral chrome, one cyan accent.
15-//! * `warm` (`--features warm`) -- a deep neutral warmed towards brown so no15+//! * `warm` -- a deep neutral warmed towards brown so no surface reads as
16-//! surface reads as office grey, with one coral accent.16+//! office grey, with one coral accent.
17 //!17 //!
18 //! Both take the clip bodies from the cross-NLE kind convention (video blue,18 //! Both take the clip bodies from the cross-NLE kind convention (video blue,
19 //! audio green, image teal, text purple) instead of four greys that differ by a19 //! audio green, image teal, text purple) instead of four greys that differ by a
20 //! hair, and both are held to the same measured floors: the contrast guards in20 //! hair, and both are held to the same measured floors: the contrast guards in
21-//! `main.rs` run against whichever one is compiled.21+//! `main.rs` run against *every* palette in [`PaletteId::ALL`], so a third one
22+//! lands gated rather than untested.
22 //!23 //!
23-//! ponytail: a compile switch, because every token is a `const` and a runtime24+//! Which family is in force is the user's, picked from the toolbar's Theme
24-//! palette means a lookup at every paint. Ceiling: the day the palette has to25+//! button or its stroke and kept in `~/.config/edith/theme` beside the
25-//! change without a restart, these two modules become two `struct Palette`26+//! keybindings -- it used to be a compile feature, which is a choice only
26-//! values and the consts become fields on the one the window holds.27+//! whoever built the binary could make. A token is a call now
28+//! ([`BG_PANEL()`]): one relaxed load and one field read off a `'static`
29+//! table, which is what "the palette can be swapped whole" costs at paint time.
27 30
28 use engine::project::LaneKind;31 use engine::project::LaneKind;
32+use std::path::PathBuf;
33+use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
29 34
30-#[cfg(not(feature = "warm"))]35+/// The whole table, once: every role, its type, and the two families' numbers
31-pub use cool::*;36+/// read out of the modules below. One list, so a role added to [`Palette`]
32-#[cfg(feature = "warm")]37+/// without a value in both families is a compile error and a role read at a
33-pub use warm::*;38+/// paint cannot come from anywhere but the palette in force.
39+macro_rules! palette {
40+ ($($name:ident: $ty:ty),+ $(,)?) => {
41+ /// One family's numbers, in a struct so the set can be swapped whole.
42+ /// Field names are the role names the whole editor already paints by,
43+ /// which is why they shout.
44+ #[allow(non_snake_case)]
45+ #[derive(Clone, Copy, PartialEq, Debug)]
46+ pub struct Palette { $(pub $name: $ty,)+ }
47+
48+ /// The families in [`PaletteId::ALL`]'s order, so the index the atomic
49+ /// holds is the id itself.
50+ static PALETTES: [Palette; 2] = [
51+ Palette { $($name: cool::$name,)+ },
52+ Palette { $($name: warm::$name,)+ },
53+ ];
54+
55+ $(
56+ #[allow(non_snake_case)]
57+ #[inline]
58+ pub fn $name() -> $ty { palette().$name }
59+ )+
60+ };
61+}
62+
63+palette! {
64+ BG_CANVAS: u32,
65+ BG_PANEL: u32,
66+ BG_RAISED: u32,
67+ BG_TIMELINE: u32,
68+ BG_HOVER: u32,
69+ BG_HOVER_DIM: u32,
70+ BG_SELECTED: u32,
71+ SCRIM: u32,
72+ SCRIM_LIGHT: u32,
73+ STROKE_DIVIDER: u32,
74+ STROKE_FOCUS: u32,
75+ STROKE_SELECTED: u32,
76+ FG_PRIMARY: u32,
77+ FG_SECONDARY: u32,
78+ FG_DISABLED: u32,
79+ ACCENT_PRIMARY: u32,
80+ ACCENT_HOVER: u32,
81+ ACCENT_PLAYHEAD: u32,
82+ ACCENT_WASH: u32,
83+ CLIP_VIDEO: u32,
84+ CLIP_AUDIO: u32,
85+ CLIP_IMAGE: u32,
86+ CLIP_TEXT: u32,
87+ SOURCE_TINTS: [u32; 4],
88+ STATUS_ERROR: u32,
89+ STATUS_WARNING: u32,
90+ STATUS_SUCCESS: u32,
91+ STATUS_PROGRESS: u32,
92+ DROP_REFUSE: u32,
93+ SUB_FG: u32,
94+ SUB_SHADE: u32,
95+ EQ_GRID: u32,
96+ EQ_SPECTRUM_INK: u32,
97+ EQ_FILL_INK: u32,
98+ EQ_BELL_INK: u32,
99+ HIST_INK: [u32; 3],
100+}
101+
102+/// Which family a person picked. An enum and not a bool: two today, and the
103+/// door in the toolbar is a list rather than a toggle because the third one
104+/// must cost a line here and nothing anywhere else.
105+#[derive(Clone, Copy, PartialEq, Eq, Debug)]
106+pub enum PaletteId {
107+ Cool,
108+ Warm,
109+}
110+
111+impl PaletteId {
112+ /// Display order -- the picker lists them in it, and the index into
113+ /// [`PALETTES`] *is* the position in it.
114+ pub const ALL: [PaletteId; 2] = [PaletteId::Cool, PaletteId::Warm];
115+
116+ /// What the button and the picker row call it.
117+ pub fn label(self) -> &'static str {
118+ match self {
119+ PaletteId::Cool => "Cool",
120+ PaletteId::Warm => "Warm",
121+ }
122+ }
123+
124+ /// The small print beside the row: what the family actually looks like, so
125+ /// the choice is made before the click rather than after it.
126+ pub fn detail(self) -> &'static str {
127+ match self {
128+ PaletteId::Cool => "near-black ground, cyan accent",
129+ PaletteId::Warm => "warm ground, coral accent",
130+ }
131+ }
132+
133+ /// What the file calls it: one word, never the label, which is free to be
134+ /// reworded ([`crate::keymap`]'s rule for the same reason).
135+ pub fn name(self) -> &'static str {
136+ match self {
137+ PaletteId::Cool => "cool",
138+ PaletteId::Warm => "warm",
139+ }
140+ }
141+
142+ fn from_name(name: &str) -> Option<Self> {
143+ Self::ALL.into_iter().find(|p| p.name() == name)
144+ }
145+
146+ /// The numbers themselves, for anything that has to measure a family that
147+ /// is not the one in force -- which is what the contrast guards do.
148+ pub fn palette(self) -> &'static Palette {
149+ &PALETTES[self as usize]
150+ }
151+}
152+
153+/// The family in force, as an index into [`PALETTES`]. An atomic because a
154+/// token is read from whatever thread happens to be painting and the value is
155+/// one `usize`; relaxed because nothing is published *with* it -- the next
156+/// repaint reads it, and the swap asks for that repaint itself.
157+static ACTIVE: AtomicUsize = AtomicUsize::new(0);
158+
159+/// The numbers every token function reads. One load, one bounds-checked index
160+/// into a `'static` table: no allocation, no hashing, no lock.
161+#[inline]
162+pub fn palette() -> &'static Palette {
163+ PALETTES.get(ACTIVE.load(Relaxed)).unwrap_or(&PALETTES[0])
164+}
165+
166+/// Which family is in force -- what the button says and the picker marks.
167+pub fn active() -> PaletteId {
168+ PaletteId::ALL
169+ .get(ACTIVE.load(Relaxed))
170+ .copied()
171+ .unwrap_or(PaletteId::Cool)
172+}
173+
174+/// Puts `id` in force. Every paint after this reads the new numbers; asking for
175+/// the repaint is the caller's, since only it holds the window.
176+pub fn set(id: PaletteId) {
177+ ACTIVE.store(id as usize, Relaxed);
178+}
179+
180+/// Where the pick lives: one word in a file beside the keybindings, so a
181+/// desktop that names an XDG directory is obeyed for both.
182+pub fn config_path() -> PathBuf {
183+ crate::keymap::Keymap::config_path().with_file_name("theme")
184+}
185+
186+/// The pick from the last session, if there was one. Anything unreadable or
187+/// unknown leaves the default in force: a theme file is not the user's work,
188+/// so a bad one is worth no message at startup.
189+pub fn load() {
190+ if let Ok(text) = std::fs::read_to_string(config_path())
191+ && let Some(id) = PaletteId::from_name(text.trim())
192+ {
193+ set(id);
194+ }
195+}
196+
197+/// Writes the pick. One word, written whole -- a torn write costs the theme and
198+/// nothing else, and [`load`] falls back to the default on one.
199+pub fn save(id: PaletteId) -> std::io::Result<()> {
200+ let path = config_path();
201+ if let Some(dir) = path.parent() {
202+ std::fs::create_dir_all(dir)?;
203+ }
204+ std::fs::write(path, format!("{}\n", id.name()))
205+}
34 206
35 /// Family B: near-black ground, cool neutral chrome, one cyan accent.207 /// Family B: near-black ground, cool neutral chrome, one cyan accent.
36 pub mod cool {208 pub mod cool {
@@ -195,11 +367,11 @@ pub const GHOST_ALPHA: u32 = 0x66;
195 367
196 /// What a clip on `kind` is painted: the timeline's whole colour language in368 /// What a clip on `kind` is painted: the timeline's whole colour language in
197 /// one call, so a lane added later cannot invent a shade of its own.369 /// one call, so a lane added later cannot invent a shade of its own.
198-pub const fn clip_kind(kind: LaneKind, image: bool) -> u32 {370+pub fn clip_kind(kind: LaneKind, image: bool) -> u32 {
199 match kind {371 match kind {
200- LaneKind::Audio => CLIP_AUDIO,372+ LaneKind::Audio => CLIP_AUDIO(),
201- LaneKind::Video if image => CLIP_IMAGE,373+ LaneKind::Video if image => CLIP_IMAGE(),
202- LaneKind::Video => CLIP_VIDEO,374+ LaneKind::Video => CLIP_VIDEO(),
203 }375 }
204 }376 }
205 377
@@ -215,13 +387,13 @@ pub const fn clip_kind(kind: LaneKind, image: bool) -> u32 {
215 pub fn notice_tone(message: &str) -> u32 {387 pub fn notice_tone(message: &str) -> u32 {
216 let has = |word: &str| message.contains(word);388 let has = |word: &str| message.contains(word);
217 if has("FAILED") || has("ERROR") || has("REFUSED") || has("CANNOT") || has("COULD NOT") {389 if has("FAILED") || has("ERROR") || has("REFUSED") || has("CANNOT") || has("COULD NOT") {
218- STATUS_ERROR390+ STATUS_ERROR()
219 } else if message.starts_with(crate::EXPORT_DONE) || has("SAVED") || has("DONE") {391 } else if message.starts_with(crate::EXPORT_DONE) || has("SAVED") || has("DONE") {
220- STATUS_SUCCESS392+ STATUS_SUCCESS()
221 } else if has("NOTHING") || has("NO ") || has("EMPTY") {393 } else if has("NOTHING") || has("NO ") || has("EMPTY") {
222- STATUS_WARNING394+ STATUS_WARNING()
223 } else {395 } else {
224- ACCENT_PRIMARY396+ ACCENT_PRIMARY()
225 }397 }
226 }398 }
227 399
crates/app/src/ui/timeline.rsmodified+42 -42
@@ -137,9 +137,9 @@ impl Player {
137 .gap(px(8.))137 .gap(px(8.))
138 .px(px(12.))138 .px(px(12.))
139 .py(px(8.))139 .py(px(8.))
140- .bg(rgb(BG_TIMELINE))140+ .bg(rgb(BG_TIMELINE()))
141 .border_t_1()141 .border_t_1()
142- .border_color(rgb(STROKE_DIVIDER))142+ .border_color(rgb(STROKE_DIVIDER()))
143 .child(143 .child(
144 div()144 div()
145 .flex_none()145 .flex_none()
@@ -169,7 +169,7 @@ impl Player {
169 .min_w(px(0.))169 .min_w(px(0.))
170 .truncate()170 .truncate()
171 .text_size(px(11.))171 .text_size(px(11.))
172- .text_color(rgb(FG_SECONDARY))172+ .text_color(rgb(FG_SECONDARY()))
173 .child(hint),173 .child(hint),
174 ),174 ),
175 )175 )
@@ -197,7 +197,7 @@ impl Player {
197 .justify_center()197 .justify_center()
198 .rounded(px(3.))198 .rounded(px(3.))
199 .cursor_pointer()199 .cursor_pointer()
200- .hover(|s| s.bg(rgb(BG_HOVER_DIM)))200+ .hover(|s| s.bg(rgb(BG_HOVER_DIM())))
201 // The strip carries no text, so the tooltip is the only201 // The strip carries no text, so the tooltip is the only
202 // place it can say what it is.202 // place it can say what it is.
203 .tooltip(|_, cx| {203 .tooltip(|_, cx| {
@@ -238,14 +238,14 @@ impl Player {
238 .w_full()238 .w_full()
239 .h(px(6.))239 .h(px(6.))
240 .rounded(px(3.))240 .rounded(px(3.))
241- .bg(rgb(BG_RAISED))241+ .bg(rgb(BG_RAISED()))
242 .child(bounds_probe(self.ruler.clone()))242 .child(bounds_probe(self.ruler.clone()))
243 .child(243 .child(
244 div()244 div()
245 .h_full()245 .h_full()
246 .w(px(filled))246 .w(px(filled))
247 .rounded(px(3.))247 .rounded(px(3.))
248- .bg(rgb(ACCENT_PRIMARY)),248+ .bg(rgb(ACCENT_PRIMARY())),
249 ),249 ),
250 ),250 ),
251 ),251 ),
@@ -288,8 +288,8 @@ impl Player {
288 .justify_end()288 .justify_end()
289 .text_size(px(10.))289 .text_size(px(10.))
290 .text_color(rgb(match below {290 .text_color(rgb(match below {
291- 0 => FG_SECONDARY,291+ 0 => FG_SECONDARY(),
292- _ => ACCENT_PRIMARY,292+ _ => ACCENT_PRIMARY(),
293 }))293 }))
294 .child(match below {294 .child(match below {
295 0 => "the last track — scroll up for the rest".to_string(),295 0 => "the last track — scroll up for the rest".to_string(),
@@ -400,10 +400,10 @@ impl Player {
400 .gap(px(6.))400 .gap(px(6.))
401 .pr(px(6.))401 .pr(px(6.))
402 .rounded(px(3.))402 .rounded(px(3.))
403- .when(!usable, |d| d.text_color(rgb(FG_SECONDARY)).opacity(0.55))403+ .when(!usable, |d| d.text_color(rgb(FG_SECONDARY())).opacity(0.55))
404 .when(usable, |d| {404 .when(usable, |d| {
405 d.cursor_pointer()405 d.cursor_pointer()
406- .hover(|s| s.bg(rgb(BG_HOVER)))406+ .hover(|s| s.bg(rgb(BG_HOVER())))
407 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {407 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
408 this.sub_track = track;408 this.sub_track = track;
409 // Picking a track is asking to see it: a409 // Picking a track is asking to see it: a
@@ -414,7 +414,7 @@ impl Player {
414 cx.notify();414 cx.notify();
415 }))415 }))
416 })416 })
417- .when(picked, |d| d.bg(rgb(BG_SELECTED)))417+ .when(picked, |d| d.bg(rgb(BG_SELECTED())))
418 .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())418 .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())
419 // The media rows' bar, same width and hard against419 // The media rows' bar, same width and hard against
420 // the same edge: one association across the panel420 // the same edge: one association across the panel
@@ -452,7 +452,7 @@ impl Player {
452 // still there, out of452 // still there, out of
453 // the way.453 // the way.
454 .when(headed, |d| {454 .when(headed, |d| {
455- d.text_color(rgb(FG_SECONDARY))455+ d.text_color(rgb(FG_SECONDARY()))
456 })456 })
457 .child(format!("{prefix} · ")),457 .child(format!("{prefix} · ")),
458 )458 )
@@ -469,7 +469,7 @@ impl Player {
469 div()469 div()
470 .truncate()470 .truncate()
471 .text_size(px(10.))471 .text_size(px(10.))
472- .text_color(rgb(FG_SECONDARY))472+ .text_color(rgb(FG_SECONDARY()))
473 .child(row.detail),473 .child(row.detail),
474 ),474 ),
475 )475 )
@@ -491,7 +491,7 @@ impl Player {
491 .justify_center()491 .justify_center()
492 .rounded(px(3.))492 .rounded(px(3.))
493 .cursor_pointer()493 .cursor_pointer()
494- .hover(|s| s.bg(rgb(BG_HOVER)))494+ .hover(|s| s.bg(rgb(BG_HOVER())))
495 .tooltip(move |_, cx| cx.new(|_| Tip(remove_tip.clone())).into())495 .tooltip(move |_, cx| cx.new(|_| Tip(remove_tip.clone())).into())
496 .on_click(cx.listener(496 .on_click(cx.listener(
497 move |this, _: &ClickEvent, _, cx| {497 move |this, _: &ClickEvent, _, cx| {
@@ -520,7 +520,7 @@ impl Player {
520 .items_center()520 .items_center()
521 .gap(px(6.))521 .gap(px(6.))
522 .text_size(px(10.))522 .text_size(px(10.))
523- .text_color(rgb(FG_SECONDARY))523+ .text_color(rgb(FG_SECONDARY()))
524 .when_some(tint, |d, tint| {524 .when_some(tint, |d, tint| {
525 d.child(525 d.child(
526 div()526 div()
@@ -547,7 +547,7 @@ impl Player {
547 div()547 div()
548 .truncate()548 .truncate()
549 .text_size(px(11.))549 .text_size(px(11.))
550- .text_color(rgb(FG_SECONDARY))550+ .text_color(rgb(FG_SECONDARY()))
551 .child(match (self.subs_on, sub_pick_name(tracks, self.sub_track)) {551 .child(match (self.subs_on, sub_pick_name(tracks, self.sub_track)) {
552 // Which of them is on screen, named by its film:552 // Which of them is on screen, named by its film:
553 // the heading over a list of five is where the one553 // the heading over a list of five is where the one
@@ -602,7 +602,7 @@ impl Player {
602 // whose subtitles these are before the tooltip is asked. `None` for a602 // whose subtitles these are before the tooltip is asked. `None` for a
603 // standalone `.srt` -- nobody's stream, and the first film's colour603 // standalone `.srt` -- nobody's stream, and the first film's colour
604 // would be a lie about where it came from.604 // would be a lie about where it came from.
605- let tint = file_tint(self.sources(), &track.path).unwrap_or(BG_RAISED);605+ let tint = file_tint(self.sources(), &track.path).unwrap_or(BG_RAISED());
606 // The whole of what the row says in words, since a 40 px column can hold606 // The whole of what the row says in words, since a 40 px column can hold
607 // three characters of it: which track of which file, how many cues, the607 // three characters of it: which track of which file, how many cues, the
608 // file itself in full -- one stem is two films when they are two cuts of608 // file itself in full -- one stem is two films when they are two cuts of
@@ -657,7 +657,7 @@ impl Player {
657 .rounded(px(3.))657 .rounded(px(3.))
658 .bg(rgb(tint))658 .bg(rgb(tint))
659 .text_size(px(9.))659 .text_size(px(9.))
660- .text_color(rgb(FG_SECONDARY))660+ .text_color(rgb(FG_SECONDARY()))
661 .truncate()661 .truncate()
662 .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())662 .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())
663 .child(label),663 .child(label),
@@ -669,7 +669,7 @@ impl Player {
669 .min_w(px(0.))669 .min_w(px(0.))
670 .h_full()670 .h_full()
671 .rounded(px(3.))671 .rounded(px(3.))
672- .bg(rgb(BG_TIMELINE))672+ .bg(rgb(BG_TIMELINE()))
673 .overflow_hidden()673 .overflow_hidden()
674 .children(cues.into_iter().map(|(left, width)| {674 .children(cues.into_iter().map(|(left, width)| {
675 div()675 div()
@@ -679,7 +679,7 @@ impl Player {
679 .left(px(left))679 .left(px(left))
680 .w(px(width))680 .w(px(width))
681 .rounded(px(2.))681 .rounded(px(2.))
682- .bg(rgb(BG_SELECTED))682+ .bg(rgb(BG_SELECTED()))
683 }))683 }))
684 // The playhead again, last and in the lanes' own colour:684 // The playhead again, last and in the lanes' own colour:
685 // the strip is only worth anything beside them if it685 // the strip is only worth anything beside them if it
@@ -691,7 +691,7 @@ impl Player {
691 .h_full()691 .h_full()
692 .left(px(filled))692 .left(px(filled))
693 .w(px(2.))693 .w(px(2.))
694- .bg(rgb(ACCENT_PLAYHEAD)),694+ .bg(rgb(ACCENT_PLAYHEAD())),
695 ),695 ),
696 ),696 ),
697 )697 )
@@ -800,9 +800,9 @@ impl Player {
800 .items_center()800 .items_center()
801 .justify_center()801 .justify_center()
802 .rounded(px(3.))802 .rounded(px(3.))
803- .bg(rgb(BG_RAISED))803+ .bg(rgb(BG_RAISED()))
804 .text_size(px(11.))804 .text_size(px(11.))
805- .text_color(rgb(FG_SECONDARY))805+ .text_color(rgb(FG_SECONDARY()))
806 .child(match audio {806 .child(match audio {
807 // A button, not a label: the one setting a track has of807 // A button, not a label: the one setting a track has of
808 // its own used to be reachable from nowhere.808 // its own used to be reachable from nowhere.
@@ -815,7 +815,7 @@ impl Player {
815 .justify_center()815 .justify_center()
816 .rounded(px(3.))816 .rounded(px(3.))
817 .cursor_pointer()817 .cursor_pointer()
818- .hover(|s| s.bg(rgb(BG_HOVER)))818+ .hover(|s| s.bg(rgb(BG_HOVER())))
819 .tooltip(move |_, cx| cx.new(|_| Tip(gain_tip.clone())).into())819 .tooltip(move |_, cx| cx.new(|_| Tip(gain_tip.clone())).into())
820 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {820 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
821 this.open_mix(Some(lane), cx)821 this.open_mix(Some(lane), cx)
@@ -848,7 +848,7 @@ impl Player {
848 .justify_center()848 .justify_center()
849 .rounded(px(3.))849 .rounded(px(3.))
850 .cursor_pointer()850 .cursor_pointer()
851- .hover(|s| s.bg(rgb(BG_HOVER)))851+ .hover(|s| s.bg(rgb(BG_HOVER())))
852 .tooltip(move |_, cx| cx.new(|_| Tip(remove_tip.clone())).into())852 .tooltip(move |_, cx| cx.new(|_| Tip(remove_tip.clone())).into())
853 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {853 .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
854 this.remove_lane(lane, cx)854 this.remove_lane(lane, cx)
@@ -866,7 +866,7 @@ impl Player {
866 .min_w(px(0.))866 .min_w(px(0.))
867 .h_full()867 .h_full()
868 .rounded(px(3.))868 .rounded(px(3.))
869- .bg(rgb(BG_TIMELINE))869+ .bg(rgb(BG_TIMELINE()))
870 .overflow_hidden()870 .overflow_hidden()
871 // A library row let go over a lane is the same insert the871 // A library row let go over a lane is the same insert the
872 // Add button makes, through the same call -- but where the872 // Add button makes, through the same call -- but where the
@@ -882,7 +882,7 @@ impl Player {
882 let at = this.place_frame(window.mouse_position().x).0;882 let at = this.place_frame(window.mouse_position().x).0;
883 this.insert_source(&drag.0.clone(), drag.1, Some(lane), Some(at), cx)883 this.insert_source(&drag.0.clone(), drag.1, Some(lane), Some(at), cx)
884 }))884 }))
885- .drag_over::<AssetDrag>(|s, _, _, _| s.bg(rgb(BG_HOVER_DIM)))885+ .drag_over::<AssetDrag>(|s, _, _, _| s.bg(rgb(BG_HOVER_DIM())))
886 // The shadow of the row in flight, drawn by the lane the886 // The shadow of the row in flight, drawn by the lane the
887 // pointer is inside: `on_drag_move` fires on every painted887 // pointer is inside: `on_drag_move` fires on every painted
888 // element while a drag of its type is live, wherever the888 // element while a drag of its type is live, wherever the
@@ -913,7 +913,7 @@ impl Player {
913 };913 };
914 this.move_clip(drag.lane, idx, lane, window.mouse_position().x, cx)914 this.move_clip(drag.lane, idx, lane, window.mouse_position().x, cx)
915 }))915 }))
916- .drag_over::<ClipDrag>(|s, _, _, _| s.bg(rgb(BG_HOVER_DIM)))916+ .drag_over::<ClipDrag>(|s, _, _, _| s.bg(rgb(BG_HOVER_DIM())))
917 // ...and the same shadow for the clip in the hand, seated on917 // ...and the same shadow for the clip in the hand, seated on
918 // this lane when the pointer is inside it.918 // this lane when the pointer is inside it.
919 .on_drag_move(cx.listener(919 .on_drag_move(cx.listener(
@@ -1018,15 +1018,15 @@ impl Player {
1018 .rounded(px(3.))1018 .rounded(px(3.))
1019 .border_1()1019 .border_1()
1020 .border_color(rgb(if on {1020 .border_color(rgb(if on {
1021- STROKE_SELECTED1021+ STROKE_SELECTED()
1022 } else if grouped {1022 } else if grouped {
1023 tint1023 tint
1024 } else {1024 } else {
1025- FG_SECONDARY1025+ FG_SECONDARY()
1026 }))1026 }))
1027- .bg(rgb(if on { BG_SELECTED } else { kind }))1027+ .bg(rgb(if on { BG_SELECTED() } else { kind }))
1028 .cursor_pointer()1028 .cursor_pointer()
1029- .hover(|s| s.border_color(rgb(ACCENT_PRIMARY)))1029+ .hover(|s| s.border_color(rgb(ACCENT_PRIMARY())))
1030 .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())1030 .tooltip(move |_, cx| cx.new(|_| Tip(tip.clone())).into())
1031 // Dragged, it *moves*: to the frame it was let go on1031 // Dragged, it *moves*: to the frame it was let go on
1032 // and to the lane it was let go over. The click that1032 // and to the lane it was let go over. The click that
@@ -1087,7 +1087,7 @@ impl Player {
1087 .w(px(EDGE_W))1087 .w(px(EDGE_W))
1088 .occlude()1088 .occlude()
1089 .cursor(CursorStyle::ResizeLeftRight)1089 .cursor(CursorStyle::ResizeLeftRight)
1090- .hover(|s| s.bg(rgb(ACCENT_PRIMARY)))1090+ .hover(|s| s.bg(rgb(ACCENT_PRIMARY())))
1091 .on_mouse_down(1091 .on_mouse_down(
1092 MouseButton::Left,1092 MouseButton::Left,
1093 cx.listener(1093 cx.listener(
@@ -1129,7 +1129,7 @@ impl Player {
1129 .h_full()1129 .h_full()
1130 .flex()1130 .flex()
1131 .items_center()1131 .items_center()
1132- .child(div().w_full().h(px(1.)).bg(rgb(BG_HOVER)))1132+ .child(div().w_full().h(px(1.)).bg(rgb(BG_HOVER())))
1133 .into_any_element(),1133 .into_any_element(),
1134 // No audio track: nothing, never a fake.1134 // No audio track: nothing, never a fake.
1135 Wave::Silent => return None,1135 Wave::Silent => return None,
@@ -1144,7 +1144,7 @@ impl Player {
1144 .justify_center()1144 .justify_center()
1145 .truncate()1145 .truncate()
1146 .text_size(px(9.))1146 .text_size(px(9.))
1147- .text_color(rgb(FG_SECONDARY))1147+ .text_color(rgb(FG_SECONDARY()))
1148 .child("audio unreadable")1148 .child("audio unreadable")
1149 .into_any_element(),1149 .into_any_element(),
1150 };1150 };
@@ -1184,9 +1184,9 @@ impl Player {
1184 .flex_none()1184 .flex_none()
1185 .px(px(3.))1185 .px(px(3.))
1186 .rounded(px(3.))1186 .rounded(px(3.))
1187- .bg(rgb(ACCENT_PRIMARY))1187+ .bg(rgb(ACCENT_PRIMARY()))
1188 .text_size(px(9.))1188 .text_size(px(9.))
1189- .text_color(rgb(BG_RAISED))1189+ .text_color(rgb(BG_RAISED()))
1190 .child(format!("{}", clip.speed)),1190 .child(format!("{}", clip.speed)),
1191 ),1191 ),
1192 )1192 )
@@ -1232,7 +1232,7 @@ impl Player {
1232 .w(px(scale1232 .w(px(scale
1233 .width_px(f64::from(len) / self.fps)1233 .width_px(f64::from(len) / self.fps)
1234 .max(SUB_CUE_MIN_W)))1234 .max(SUB_CUE_MIN_W)))
1235- .bg(rgba(ACCENT_WASH))1235+ .bg(rgba(ACCENT_WASH()))
1236 }),1236 }),
1237 )1237 )
1238 // Where the thing in the hand would come to rest, at the size1238 // Where the thing in the hand would come to rest, at the size
@@ -1254,13 +1254,13 @@ impl Player {
1254 .max(GHOST_MIN)))1254 .max(GHOST_MIN)))
1255 .rounded(px(3.))1255 .rounded(px(3.))
1256 .border_1()1256 .border_1()
1257- .border_color(rgb(if g.refused { DROP_REFUSE } else { FG_PRIMARY }))1257+ .border_color(rgb(if g.refused { DROP_REFUSE() } else { FG_PRIMARY() }))
1258 // The file's own swatch at a third of its weight, so1258 // The file's own swatch at a third of its weight, so
1259 // the box beneath is still legible through it -- and1259 // the box beneath is still legible through it -- and
1260 // the refusal red instead, for a lane that will not1260 // the refusal red instead, for a lane that will not
1261 // take this drop at all.1261 // take this drop at all.
1262 .bg(rgba(1262 .bg(rgba(
1263- ((if g.refused { DROP_REFUSE } else { g.tint }) << 8) | GHOST_ALPHA,1263+ ((if g.refused { DROP_REFUSE() } else { g.tint }) << 8) | GHOST_ALPHA,
1264 ))1264 ))
1265 }))1265 }))
1266 // What the gesture in flight is about to land on, drawn on1266 // What the gesture in flight is about to land on, drawn on
@@ -1275,7 +1275,7 @@ impl Player {
1275 .h_full()1275 .h_full()
1276 .left(px(x))1276 .left(px(x))
1277 .w(px(1.))1277 .w(px(1.))
1278- .bg(rgb(FG_PRIMARY))1278+ .bg(rgb(FG_PRIMARY()))
1279 }))1279 }))
1280 // Last, so it is over the clips: the same fraction in both1280 // Last, so it is over the clips: the same fraction in both
1281 // lanes, which is the playhead being one line.1281 // lanes, which is the playhead being one line.
@@ -1286,7 +1286,7 @@ impl Player {
1286 .h_full()1286 .h_full()
1287 .left(px(filled))1287 .left(px(filled))
1288 .w(px(2.))1288 .w(px(2.))
1289- .bg(rgb(ACCENT_PLAYHEAD)),1289+ .bg(rgb(ACCENT_PLAYHEAD())),
1290 ),1290 ),
1291 )1291 )
1292 }1292 }
crates/app/src/ui/toolbar.rsmodified+43 -27
@@ -58,16 +58,16 @@ impl Player {
58 .items_center()58 .items_center()
59 .gap(px(8.))59 .gap(px(8.))
60 .px(px(12.))60 .px(px(12.))
61- .bg(rgb(BG_PANEL))61+ .bg(rgb(BG_PANEL()))
62 .border_b_1()62 .border_b_1()
63- .border_color(rgb(STROKE_DIVIDER))63+ .border_color(rgb(STROKE_DIVIDER()))
64 .child(64 .child(
65 div()65 div()
66 .flex_none()66 .flex_none()
67 .w(px(10.))67 .w(px(10.))
68 .h(px(10.))68 .h(px(10.))
69 .rounded(px(2.))69 .rounded(px(2.))
70- .bg(rgb(ACCENT_PRIMARY)),70+ .bg(rgb(ACCENT_PRIMARY())),
71 )71 )
72 .child(72 .child(
73 div()73 div()
@@ -79,7 +79,7 @@ impl Player {
79 .child(self.action_control(79 .child(self.action_control(
80 "save",80 "save",
81 0.,81 0.,
82- BG_RAISED,82+ BG_RAISED(),
83 None,83 None,
84 "Save",84 "Save",
85 "writes the project file",85 "writes the project file",
@@ -98,7 +98,7 @@ impl Player {
98 // The one accented button in the window: the primary98 // The one accented button in the window: the primary
99 // action of an editor, where every consumer editor puts99 // action of an editor, where every consumer editor puts
100 // it. Cancel keeps the rect and the accent both.100 // it. Cancel keeps the rect and the accent both.
101- ACCENT_PRIMARY,101+ ACCENT_PRIMARY(),
102 None,102 None,
103 if exporting { "Cancel" } else { "Export" },103 if exporting { "Cancel" } else { "Export" },
104 if exporting {104 if exporting {
@@ -150,13 +150,13 @@ impl Player {
150 .items_center()150 .items_center()
151 .gap(px(8.))151 .gap(px(8.))
152 .px(px(12.))152 .px(px(12.))
153- .bg(rgb(BG_PANEL))153+ .bg(rgb(BG_PANEL()))
154 .border_t_1()154 .border_t_1()
155- .border_color(rgb(STROKE_DIVIDER))155+ .border_color(rgb(STROKE_DIVIDER()))
156 .child(self.action_control(156 .child(self.action_control(
157 "transport",157 "transport",
158 40.,158 40.,
159- BG_RAISED,159+ BG_RAISED(),
160 Some(transport_glyph(state).into_any_element()),160 Some(transport_glyph(state).into_any_element()),
161 "",161 "",
162 "plays and pauses the timeline",162 "plays and pauses the timeline",
@@ -171,7 +171,7 @@ impl Player {
171 .flex_none()171 .flex_none()
172 .w(px(clock_w))172 .w(px(clock_w))
173 .truncate()173 .truncate()
174- .text_color(rgb(FG_PRIMARY))174+ .text_color(rgb(FG_PRIMARY()))
175 .child(format!(175 .child(format!(
176 "{} / {}",176 "{} / {}",
177 timecode(position, self.fps),177 timecode(position, self.fps),
@@ -190,7 +190,7 @@ impl Player {
190 .child(self.action_control(190 .child(self.action_control(
191 "volume",191 "volume",
192 VOLUME_SLOT_W,192 VOLUME_SLOT_W,
193- BG_RAISED,193+ BG_RAISED(),
194 None,194 None,
195 // The level is the label either way and it lives in a fixed195 // The level is the label either way and it lives in a fixed
196 // rect: muting adds a mark and changes the colour, where it196 // rect: muting adds a mark and changes the colour, where it
@@ -207,8 +207,8 @@ impl Player {
207 }),207 }),
208 ))208 ))
209 .text_color(rgb(match muted {209 .text_color(rgb(match muted {
210- true => STATUS_WARNING,210+ true => STATUS_WARNING(),
211- false => FG_PRIMARY,211+ false => FG_PRIMARY(),
212 }))212 }))
213 .when(slider, |d| {213 .when(slider, |d| {
214 d.child(volume_slider(214 d.child(volume_slider(
@@ -237,9 +237,9 @@ impl Player {
237 .items_center()237 .items_center()
238 .gap(px(8.))238 .gap(px(8.))
239 .px(px(12.))239 .px(px(12.))
240- .bg(rgb(BG_PANEL))240+ .bg(rgb(BG_PANEL()))
241 .border_t_1()241 .border_t_1()
242- .border_color(rgb(STROKE_DIVIDER))242+ .border_color(rgb(STROKE_DIVIDER()))
243 .child(243 .child(
244 div()244 div()
245 .id("controls")245 .id("controls")
@@ -253,7 +253,7 @@ impl Player {
253 .child(self.action_control(253 .child(self.action_control(
254 "cut",254 "cut",
255 0.,255 0.,
256- BG_RAISED,256+ BG_RAISED(),
257 Some(cut_glyph().into_any_element()),257 Some(cut_glyph().into_any_element()),
258 "Split",258 "Split",
259 "splits the clip under the playhead",259 "splits the clip under the playhead",
@@ -263,7 +263,7 @@ impl Player {
263 .child(self.action_control(263 .child(self.action_control(
264 "delete",264 "delete",
265 0.,265 0.,
266- BG_RAISED,266+ BG_RAISED(),
267 Some(delete_glyph().into_any_element()),267 Some(delete_glyph().into_any_element()),
268 "Delete",268 "Delete",
269 "takes the marked clip off the timeline",269 "takes the marked clip off the timeline",
@@ -273,7 +273,7 @@ impl Player {
273 .child(self.action_control(273 .child(self.action_control(
274 "undo",274 "undo",
275 0.,275 0.,
276- BG_RAISED,276+ BG_RAISED(),
277 None,277 None,
278 "Undo",278 "Undo",
279 "takes the last edit back",279 "takes the last edit back",
@@ -285,7 +285,7 @@ impl Player {
285 .child(self.action_control(285 .child(self.action_control(
286 "add-video-lane",286 "add-video-lane",
287 0.,287 0.,
288- BG_RAISED,288+ BG_RAISED(),
289 None,289 None,
290 "+ V",290 "+ V",
291 "adds a video track under the ones there",291 "adds a video track under the ones there",
@@ -297,7 +297,7 @@ impl Player {
297 .child(self.action_control(297 .child(self.action_control(
298 "add-audio-lane",298 "add-audio-lane",
299 0.,299 0.,
300- BG_RAISED,300+ BG_RAISED(),
301 None,301 None,
302 "+ A",302 "+ A",
303 "adds an audio track under the ones there",303 "adds an audio track under the ones there",
@@ -309,7 +309,7 @@ impl Player {
309 .child(self.action_control(309 .child(self.action_control(
310 "add-subtitle-track",310 "add-subtitle-track",
311 0.,311 0.,
312- BG_RAISED,312+ BG_RAISED(),
313 None,313 None,
314 "+ S",314 "+ S",
315 "adds every subtitle track in a file you pick",315 "adds every subtitle track in a file you pick",
@@ -326,7 +326,7 @@ impl Player {
326 .child(self.action_control(326 .child(self.action_control(
327 "snap",327 "snap",
328 SNAP_SLOT_W,328 SNAP_SLOT_W,
329- BG_RAISED,329+ BG_RAISED(),
330 None,330 None,
331 if self.snap { "Snap on" } else { "Snap off" },331 if self.snap { "Snap on" } else { "Snap off" },
332 match self.snap {332 match self.snap {
@@ -339,7 +339,7 @@ impl Player {
339 .child(self.action_control(339 .child(self.action_control(
340 "subs",340 "subs",
341 SNAP_SLOT_W,341 SNAP_SLOT_W,
342- BG_RAISED,342+ BG_RAISED(),
343 None,343 None,
344 match (self.subtitle_track().is_some(), self.subs_on) {344 match (self.subtitle_track().is_some(), self.subs_on) {
345 (false, _) => "No subs",345 (false, _) => "No subs",
@@ -350,11 +350,23 @@ impl Player {
350 ActionId::ToggleSubtitles,350 ActionId::ToggleSubtitles,
351 cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_subtitles(cx)),351 cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_subtitles(cx)),
352 ))352 ))
353+ .child(self.action_control(
354+ "theme",
355+ THEME_SLOT_W,
356+ BG_RAISED(),
357+ None,
358+ format!("Theme: {}", crate::ui::theme::active().label()),
359+ "the colours this window is painted in; kept in ~/.config/edith/theme",
360+ ActionId::Theme,
361+ cx.listener(|this, event: &ClickEvent, _, cx| {
362+ this.open_picker(Pick::Theme, event.position(), cx)
363+ }),
364+ ))
353 .child(separator())365 .child(separator())
354 .child(self.action_control(366 .child(self.action_control(
355 "zoom-out",367 "zoom-out",
356 CONTROL_H,368 CONTROL_H,
357- BG_RAISED,369+ BG_RAISED(),
358 None,370 None,
359 "−",371 "−",
360 "show more of the timeline; stops with all of it on the bed",372 "show more of the timeline; stops with all of it on the bed",
@@ -366,7 +378,7 @@ impl Player {
366 .child(self.action_control(378 .child(self.action_control(
367 "zoom-fit",379 "zoom-fit",
368 ZOOM_SLOT_W,380 ZOOM_SLOT_W,
369- BG_RAISED,381+ BG_RAISED(),
370 None,382 None,
371 span_label(self.view().span()),383 span_label(self.view().span()),
372 "fit the whole timeline on the bed",384 "fit the whole timeline on the bed",
@@ -376,7 +388,7 @@ impl Player {
376 .child(self.action_control(388 .child(self.action_control(
377 "zoom-in",389 "zoom-in",
378 CONTROL_H,390 CONTROL_H,
379- BG_RAISED,391+ BG_RAISED(),
380 None,392 None,
381 "+",393 "+",
382 "magnify around the playhead; ctrl+wheel on the ruler zooms at the pointer",394 "magnify around the playhead; ctrl+wheel on the ruler zooms at the pointer",
@@ -386,7 +398,7 @@ impl Player {
386 .child(self.action_control(398 .child(self.action_control(
387 "keys",399 "keys",
388 0.,400 0.,
389- BG_RAISED,401+ BG_RAISED(),
390 None,402 None,
391 "Actions",403 "Actions",
392 "do any action, or change the key that does it",404 "do any action, or change the key that does it",
@@ -406,7 +418,7 @@ impl Player {
406 .child(control(418 .child(control(
407 "controls-more",419 "controls-more",
408 CONTROL_H,420 CONTROL_H,
409- BG_RAISED,421+ BG_RAISED(),
410 None,422 None,
411 "⋯",423 "⋯",
412 format!(424 format!(
@@ -434,6 +446,10 @@ pub(crate) const ZOOM_SLOT_W: f32 = 76.;
434 pub(crate) const VOLUME_SLOT_W: f32 = 76.;446 pub(crate) const VOLUME_SLOT_W: f32 = 76.;
435 /// The HDR rendition's names are the longest words on any button here.447 /// The HDR rendition's names are the longest words on any button here.
436 pub(crate) const TONE_SLOT_W: f32 = 148.;448 pub(crate) const TONE_SLOT_W: f32 = 148.;
449+/// "Theme: " and the longest palette name: a fixed rect like the two toggles
450+/// beside it, so picking a palette repaints the button without moving the ones
451+/// after it.
452+pub(crate) const THEME_SLOT_W: f32 = 96.;
437 453
438 /// The width the transport strip needs before the level's bar fits beside the454 /// The width the transport strip needs before the level's bar fits beside the
439 /// clock: play + clock + the mute button + the bar, in their gaps.455 /// clock: play + clock + the mute button + the bar, in their gaps.
crates/app/src/ui/widgets.rsmodified+19 -19
@@ -28,7 +28,7 @@ pub(crate) fn waveform(peaks: Arc<Vec<(f32, f32)>>, from: f64, to: f64) -> impl
28 let mut path = PathBuilder::fill();28 let mut path = PathBuilder::fill();
29 path.add_polygon(&points, true);29 path.add_polygon(&points, true);
30 if let Ok(path) = path.build() {30 if let Ok(path) = path.build() {
31- window.paint_path(path, rgb(FG_SECONDARY));31+ window.paint_path(path, rgb(FG_SECONDARY()));
32 }32 }
33 },33 },
34 )34 )
@@ -72,7 +72,7 @@ pub(crate) fn control(
72 .when(w > 0., |d| d.w(px(w)).overflow_hidden())72 .when(w > 0., |d| d.w(px(w)).overflow_hidden())
73 .rounded(px(4.))73 .rounded(px(4.))
74 .bg(rgb(bg))74 .bg(rgb(bg))
75- .when(bg == ACCENT_PRIMARY, |d| d.text_color(rgb(BG_CANVAS)))75+ .when(bg == ACCENT_PRIMARY(), |d| d.text_color(rgb(BG_CANVAS())))
76 // A glyph sits in a box of its own width, never in the width it happens76 // A glyph sits in a box of its own width, never in the width it happens
77 // to draw: the pause bars are 12 px wide and the play triangle is 11, so77 // to draw: the pause bars are 12 px wide and the play triangle is 11, so
78 // pressing Play used to slide every button in the row one pixel left. A78 // pressing Play used to slide every button in the row one pixel left. A
@@ -95,9 +95,9 @@ pub(crate) fn control(
95 // turning itself off.95 // turning itself off.
96 d.cursor_pointer()96 d.cursor_pointer()
97 .hover(move |s| {97 .hover(move |s| {
98- s.bg(rgb(match bg == ACCENT_PRIMARY {98+ s.bg(rgb(match bg == ACCENT_PRIMARY() {
99- true => ACCENT_HOVER,99+ true => ACCENT_HOVER(),
100- false => BG_HOVER,100+ false => BG_HOVER(),
101 }))101 }))
102 })102 })
103 .on_click(on_click)103 .on_click(on_click)
@@ -146,13 +146,13 @@ pub(crate) fn volume_slider(
146 .w_full()146 .w_full()
147 .h(px(4.))147 .h(px(4.))
148 .rounded(px(2.))148 .rounded(px(2.))
149- .bg(rgb(BG_RAISED))149+ .bg(rgb(BG_RAISED()))
150 .child(150 .child(
151 div()151 div()
152 .h_full()152 .h_full()
153 .w(relative(volume.along()))153 .w(relative(volume.along()))
154 .rounded(px(2.))154 .rounded(px(2.))
155- .bg(rgb(if volume.muted { FG_SECONDARY } else { ACCENT_PRIMARY })),155+ .bg(rgb(if volume.muted { FG_SECONDARY() } else { ACCENT_PRIMARY() })),
156 ),156 ),
157 )157 )
158 }158 }
@@ -165,7 +165,7 @@ pub(crate) fn group_label(name: &'static str) -> impl IntoElement {
165 div()165 div()
166 .flex_none()166 .flex_none()
167 .text_size(px(10.))167 .text_size(px(10.))
168- .text_color(rgb(FG_SECONDARY))168+ .text_color(rgb(FG_SECONDARY()))
169 .child(name)169 .child(name)
170 }170 }
171 171
@@ -175,7 +175,7 @@ pub(crate) fn separator() -> impl IntoElement {
175 .mx(px(4.))175 .mx(px(4.))
176 .w(px(1.))176 .w(px(1.))
177 .h(px(18.))177 .h(px(18.))
178- .bg(rgb(BG_HOVER))178+ .bg(rgb(BG_HOVER()))
179 }179 }
180 180
181 /// Whether a card or a menu is drawn over the window, as the hover labels see181 /// Whether a card or a menu is drawn over the window, as the hover labels see
@@ -209,9 +209,9 @@ impl Render for Tip {
209 .py(px(3.))209 .py(px(3.))
210 .rounded(px(3.))210 .rounded(px(3.))
211 .border_1()211 .border_1()
212- .border_color(rgb(BG_RAISED))212+ .border_color(rgb(BG_RAISED()))
213- .bg(rgb(BG_PANEL))213+ .bg(rgb(BG_PANEL()))
214- .text_color(rgb(FG_PRIMARY))214+ .text_color(rgb(FG_PRIMARY()))
215 .text_size(px(12.))215 .text_size(px(12.))
216 .child(self.0.clone())216 .child(self.0.clone())
217 }217 }
@@ -231,7 +231,7 @@ pub(crate) fn cut_glyph() -> impl IntoElement {
231 path.move_to(point(o.x + s.width * 0.85, o.y + s.height));231 path.move_to(point(o.x + s.width * 0.85, o.y + s.height));
232 path.line_to(point(o.x + s.width * 0.1, o.y + s.height * 0.1));232 path.line_to(point(o.x + s.width * 0.1, o.y + s.height * 0.1));
233 if let Ok(path) = path.build() {233 if let Ok(path) = path.build() {
234- window.paint_path(path, rgb(FG_PRIMARY));234+ window.paint_path(path, rgb(FG_PRIMARY()));
235 }235 }
236 },236 },
237 )237 )
@@ -246,8 +246,8 @@ pub(crate) fn delete_glyph() -> impl IntoElement {
246 .flex_col()246 .flex_col()
247 .items_center()247 .items_center()
248 .gap(px(2.))248 .gap(px(2.))
249- .child(div().w(px(13.)).h(px(2.)).bg(rgb(FG_PRIMARY)))249+ .child(div().w(px(13.)).h(px(2.)).bg(rgb(FG_PRIMARY())))
250- .child(div().w(px(9.)).h(px(9.)).bg(rgb(FG_PRIMARY)))250+ .child(div().w(px(9.)).h(px(9.)).bg(rgb(FG_PRIMARY())))
251 }251 }
252 252
253 /// What a window with no file open is waiting for. Both ways in are already253 /// What a window with no file open is waiting for. Both ways in are already
@@ -259,7 +259,7 @@ pub(crate) fn empty_hint() -> impl IntoElement {
259 .flex_col()259 .flex_col()
260 .items_center()260 .items_center()
261 .gap(px(6.))261 .gap(px(6.))
262- .text_color(rgb(FG_SECONDARY))262+ .text_color(rgb(FG_SECONDARY()))
263 .child("Drop a video or an .edith project here")263 .child("Drop a video or an .edith project here")
264 .child(264 .child(
265 div()265 div()
@@ -279,8 +279,8 @@ pub(crate) fn transport_glyph(state: Transport) -> impl IntoElement {
279 .items_center()279 .items_center()
280 .gap(px(4.))280 .gap(px(4.))
281 .when(playing, |d| {281 .when(playing, |d| {
282- d.child(div().w(px(3.)).h(px(12.)).bg(rgb(FG_PRIMARY)))282+ d.child(div().w(px(3.)).h(px(12.)).bg(rgb(FG_PRIMARY())))
283- .child(div().w(px(3.)).h(px(12.)).bg(rgb(FG_PRIMARY)))283+ .child(div().w(px(3.)).h(px(12.)).bg(rgb(FG_PRIMARY())))
284 })284 })
285 .when(!playing, |d| {285 .when(!playing, |d| {
286 d.child(286 d.child(
@@ -294,7 +294,7 @@ pub(crate) fn transport_glyph(state: Transport) -> impl IntoElement {
294 path.line_to(point(o.x, o.y + s.height));294 path.line_to(point(o.x, o.y + s.height));
295 path.close();295 path.close();
296 if let Ok(path) = path.build() {296 if let Ok(path) = path.build() {
297- window.paint_path(path, rgb(FG_PRIMARY));297+ window.paint_path(path, rgb(FG_PRIMARY()));
298 }298 }
299 },299 },
300 )300 )