The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
feat(ui): accent colours in Settings › Appearance
Jareerc3a1700f8b81
diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.jsonindex 38898718..aedf639c 100644--- a/src/crates/concat/locales/de.json+++ b/src/crates/concat/locales/de.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "Was eine Verbindung vor ihrem ersten Aufruf vorzeigen muss. Bleibt es leer, denkt sich der Server bei jedem Start eines aus und zeigt es hier.","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "Akzent",+ "Lime": "Limette",+ "Violet": "Violett",+ "Rose": "Rosé",+ "Amber": "Amber",+ "Mint": "Minze"}diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.jsonindex 79168a7f..f6a78126 100644--- a/src/crates/concat/locales/en.json+++ b/src/crates/concat/locales/en.json@@ -53,6 +53,7 @@"A whip zoom out of the outgoing shot and into the incoming one.": "A whip zoom out of the outgoing shot and into the incoming one.","About": "About","About {0}:{1} in {2} · {3} characters": "About {0}:{1} in {2} · {3} characters",+ "Accent": "Accent","Add": "Add","Add a panel": "Add a panel","Add captions": "Add captions",@@ -68,6 +69,7 @@"Airy, breathy tone with attenuated low end and enhanced presence.": "Airy, breathy tone with attenuated low end and enhanced presence.","All media": "All media","almost done": "almost done",+ "Amber": "Amber","American": "American","Amount": "Amount","Amplitude": "Amplitude",@@ -468,6 +470,7 @@"Lighten": "Lighten","Lightness": "Lightness","Lights": "Lights",+ "Lime": "Lime","Limited": "Limited","Line height": "Line height","Linear Wipe": "Linear Wipe",@@ -509,6 +512,7 @@"Miniature horizontal focus band with progressive blur and saturation.": "Miniature horizontal focus band with progressive blur and saturation.","Minimal": "Minimal","Minimum": "Minimum",+ "Mint": "Mint","Mirror": "Mirror","Mirror Tile": "Mirror Tile","Missing Media": "Missing Media",@@ -691,6 +695,7 @@"Robot": "Robot","Roll In": "Roll In","Room": "Room",+ "Rose": "Rose","Rosy": "Rosy","Rotation": "Rotation","Rotational vortex twist around a focal point.": "Rotational vortex twist around a focal point.",@@ -928,6 +933,7 @@"Vintage countdown leader with film grain and gate weave.": "Vintage countdown leader with film grain and gate weave.","Vintage VHS/camcorder on-screen display with tracking noise.": "Vintage VHS/camcorder on-screen display with tracking noise.","Vinyl": "Vinyl",+ "Violet": "Violet","Vivid": "Vivid","Vivid Landscape": "Vivid Landscape","Voice": "Voice",diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.jsonindex 6455b9f2..e4540013 100644--- a/src/crates/concat/locales/es.json+++ b/src/crates/concat/locales/es.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "Lo que una conexión debe presentar antes de su primera llamada. Si se deja vacío, el servidor inventa uno cada vez que arranca y lo muestra aquí.","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "Acento",+ "Lime": "Lima",+ "Violet": "Violeta",+ "Rose": "Rosa",+ "Amber": "Ámbar",+ "Mint": "Menta"}diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.jsonindex c57eca8a..322b30c9 100644--- a/src/crates/concat/locales/fa.json+++ b/src/crates/concat/locales/fa.json@@ -714,5 +714,11 @@"{0} months ago": "{0} ماه پیش","{0} strokes": "{0} Stroke","{0}m {1}s left": "{0}m {1}s باقی مانده",- "{0}s left": "{0}s باقی مانده"+ "{0}s left": "{0}s باقی مانده",+ "Accent": "رنگ تأکید",+ "Lime": "لیمویی",+ "Violet": "بنفش",+ "Rose": "گلی",+ "Amber": "کهربایی",+ "Mint": "نعنایی"}diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.jsonindex 4b75917b..80632c82 100644--- a/src/crates/concat/locales/fr.json+++ b/src/crates/concat/locales/fr.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "Ce qu'une connexion doit présenter avant son premier appel. Laissé vide, le serveur en invente un à chaque démarrage et l'affiche ici.","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "Accent",+ "Lime": "Citron vert",+ "Violet": "Violet",+ "Rose": "Rose",+ "Amber": "Ambre",+ "Mint": "Menthe"}diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.jsonindex 777b66c2..b908fa51 100644--- a/src/crates/concat/locales/hr.json+++ b/src/crates/concat/locales/hr.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "Što veza mora predočiti prije prvog poziva. Ostane li prazno, poslužitelj ga sam smisli pri svakom pokretanju i prikaže ovdje.","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "Naglasak",+ "Lime": "Limeta",+ "Violet": "Ljubičasta",+ "Rose": "Ruža",+ "Amber": "Jantar",+ "Mint": "Menta"}diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.jsonindex 34617ccf..2abbfb72 100644--- a/src/crates/concat/locales/it.json+++ b/src/crates/concat/locales/it.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "Ciò che una connessione deve presentare prima della prima chiamata. Se lasciato vuoto, il server ne inventa uno a ogni avvio e lo mostra qui.","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "Accento",+ "Lime": "Lime",+ "Violet": "Viola",+ "Rose": "Rosa",+ "Amber": "Ambra",+ "Mint": "Menta"}diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.jsonindex ac6f6d09..3cf518f9 100644--- a/src/crates/concat/locales/ja.json+++ b/src/crates/concat/locales/ja.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "接続が最初の呼び出しの前に提示するもの。空のままにすると、サーバーは起動のたびに自分で作り、ここに表示します。","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "アクセント",+ "Lime": "ライム",+ "Violet": "バイオレット",+ "Rose": "ローズ",+ "Amber": "アンバー",+ "Mint": "ミント"}diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.jsonindex 1f541698..08e5832e 100644--- a/src/crates/concat/locales/ko.json+++ b/src/crates/concat/locales/ko.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "연결이 첫 호출 전에 제시해야 하는 값입니다. 비워 두면 서버가 시작할 때마다 하나를 만들어 여기에 표시합니다.","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "강조색",+ "Lime": "라임",+ "Violet": "바이올렛",+ "Rose": "로즈",+ "Amber": "앰버",+ "Mint": "민트"}diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.jsonindex 9162982b..ac0ac12e 100644--- a/src/crates/concat/locales/pt-BR.json+++ b/src/crates/concat/locales/pt-BR.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "O que uma conexão precisa apresentar antes da primeira chamada. Se ficar vazio, o servidor inventa um a cada início e o mostra aqui.","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "Destaque",+ "Lime": "Limão",+ "Violet": "Violeta",+ "Rose": "Rosa",+ "Amber": "Âmbar",+ "Mint": "Menta"}diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.jsonindex 20a2e5dc..815a3a5e 100644--- a/src/crates/concat/locales/ru.json+++ b/src/crates/concat/locales/ru.json@@ -738,5 +738,11 @@"Stroke": "Обводка","Text Align": "Выравнивание текста","Typography": "Типографика",- "Undo (⌘Z)": "Отменить (⌘Z)"+ "Undo (⌘Z)": "Отменить (⌘Z)",+ "Accent": "Акцент",+ "Lime": "Лайм",+ "Violet": "Фиолетовый",+ "Rose": "Розовый",+ "Amber": "Янтарь",+ "Mint": "Мята"}diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.jsonindex 2608362f..3b6577a7 100644--- a/src/crates/concat/locales/tr.json+++ b/src/crates/concat/locales/tr.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "Bir bağlantının ilk çağrısından önce sunması gereken şey. Boş bırakılırsa sunucu her başlatıldığında bir tane uydurur ve burada gösterir.","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "Vurgu",+ "Lime": "Limon yeşili",+ "Violet": "Menekşe",+ "Rose": "Gül",+ "Amber": "Amber",+ "Mint": "Nane"}diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.jsonindex 96073bfd..b0e4752b 100644--- a/src/crates/concat/locales/zh-Hans.json+++ b/src/crates/concat/locales/zh-Hans.json@@ -720,5 +720,11 @@"What a connection must present before its first call. Left empty, the server makes one up each time it starts and shows it here.": "连接在首次调用前必须出示的内容。留空时,服务器每次启动都会自行生成一个并显示在这里。","Decode on the hardware": "Decode on the hardware","Decoding": "Decoding",- "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before."+ "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.": "On, video decodes on this machine's own hardware, which is what makes 4K play on a laptop. A file the hardware will not take decodes in software as before.",+ "Accent": "强调色",+ "Lime": "青柠",+ "Violet": "紫罗兰",+ "Rose": "玫红",+ "Amber": "琥珀",+ "Mint": "薄荷"}diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.jsonindex b3269884..28a3a930 100644--- a/src/crates/concat/locales/zh-TW.json+++ b/src/crates/concat/locales/zh-TW.json@@ -975,5 +975,11 @@"{0} months ago": "{0} 個月前","{0} strokes": "{0} 筆","{0}m {1}s left": "剩餘 {0} 分 {1} 秒",- "{0}s left": "剩餘 {0} 秒"+ "{0}s left": "剩餘 {0} 秒",+ "Accent": "強調色",+ "Lime": "青檸",+ "Violet": "紫羅蘭",+ "Rose": "玫紅",+ "Amber": "琥珀",+ "Mint": "薄荷"}diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rsindex 8e501042..584ad0a9 100644--- a/src/crates/concat/src/lib.rs+++ b/src/crates/concat/src/lib.rs@@ -137,6 +137,27 @@ pub fn run() -> Result<(), slint::PlatformError> {studio.watch_packages();let dark = studio.prefs.dark.unwrap_or(true);app.global::<Theme>().set_dark(dark);+ // The accent is remembered by name and the names live on the Theme+ // global, so the index is looked up there rather than kept in Rust too.+ // A remembered hex is a colour picked by hand, which is the slot past+ // the names.+ {+ let theme = app.global::<Theme>();+ let names = theme.get_accent_names();+ let count = slint::Model::row_count(&names);+ match studio.prefs.custom_accent().and_then(format::parse_colour) {+ Some(colour) => {+ theme.set_accent_custom(colour);+ theme.set_accent_choice(count as i32);+ }+ None => {+ let index = studio+ .prefs+ .accent_index(slint::Model::iter(&names).map(|name| name.to_string()));+ theme.set_accent_choice(index as i32);+ }+ }+ }let shell = Rc::new(Shell {app: app.as_weak(),@@ -1039,6 +1060,42 @@ pub fn run() -> Result<(), slint::PlatformError> {});}});+ // The accent is the same shape of thing: one int on the Theme global,+ // remembered under the name the global lists it by.+ app.on_settings_accent_changed({+ move |index| {+ Shell::with(|shell, app| {+ let theme = app.global::<Theme>();+ let names = theme.get_accent_names();+ let Some(name) = usize::try_from(index)+ .ok()+ .and_then(|row| slint::Model::row_data(&names, row))+ else {+ return;+ };+ theme.set_accent_choice(index);+ let mut studio = shell.studio.borrow_mut();+ studio.prefs.accent = Some(prefs::Preferences::accent_id(&name));+ studio.prefs.save(&studio.host.dirs);+ });+ }+ });+ // A picked colour is remembered as its hex, which is what tells it from+ // a name when the file is read back. Every drag on the picker's square+ // lands here, so the file is written often for a moment; it is small.+ app.on_settings_accent_custom_changed({+ move |colour| {+ Shell::with(|shell, app| {+ let theme = app.global::<Theme>();+ let count = slint::Model::row_count(&theme.get_accent_names());+ theme.set_accent_custom(colour);+ theme.set_accent_choice(count as i32);+ let mut studio = shell.studio.borrow_mut();+ studio.prefs.accent = Some(format::hex_of(colour));+ studio.prefs.save(&studio.host.dirs);+ });+ }+ });app.on_export_closed(on_window!(|state| {state.handle(Msg::Export(ExportMsg::Close));}));diff --git a/src/crates/concat/src/prefs.rs b/src/crates/concat/src/prefs.rsindex b57d80bb..1c3b6347 100644--- a/src/crates/concat/src/prefs.rs+++ b/src/crates/concat/src/prefs.rs@@ -17,6 +17,11 @@ const FILE: &str = "settings.json";pub struct Preferences {/// The dark theme. `None` is the app's default, which is dark.pub dark: Option<bool>,+ /// The accent, by the lower-cased name the theme lists it under —+ /// "lime", "sky", ... — or as "#rrggbb" for a colour picked by hand.+ /// `None`, or a name no longer on the list, is the first one, which is+ /// Lime.+ pub accent: Option<String>,/// The chosen transcriber model id, e.g. "base.en".pub transcriber_model: Option<String>,/// The chosen speech model id.@@ -73,6 +78,37 @@ impl Preferences {self.hardware_decode.unwrap_or(cfg!(any(target_os = "macos", target_os = "ios")))}++ /// Which of `names` — the theme's accents, in its order — the remembered+ /// accent is. The first when nothing is remembered, and the first when+ /// the name is one the list no longer has: it is the default, and a+ /// choice that has gone away should fall back to the default rather+ /// than to whatever happens to sit at its old position.+ pub fn accent_index(&self, names: impl IntoIterator<Item = impl AsRef<str>>) -> usize {+ let Some(wanted) = self.accent.as_deref().map(str::trim) else {+ return 0;+ };+ names+ .into_iter()+ .position(|name| Self::accent_id(name.as_ref()) == wanted.to_lowercase())+ .unwrap_or(0)+ }++ /// The id an accent is remembered under: its name, lower-cased, so the+ /// file reads `"accent": "sky"` and a hand-typed capital still matches.+ pub fn accent_id(name: &str) -> String {+ name.trim().to_lowercase()+ }++ /// The remembered accent when it is a colour rather than a name: the+ /// hex, for the caller to parse. A hash is what tells the two apart,+ /// and no name on the list starts with one.+ pub fn custom_accent(&self) -> Option<&str> {+ self.accent+ .as_deref()+ .map(str::trim)+ .filter(|text| text.starts_with('#'))+ }}/// The Settings sheet's Remote page: whether the API is served while the@@ -121,3 +157,94 @@ impl Preferences {}}}++#[cfg(test)]+mod tests {+ use super::*;++ const NAMES: [&str; 3] = ["Lime", "Sky", "Violet"];++ /// Nothing remembered is the first accent, which is the default.+ #[test]+ fn no_accent_is_the_first() {+ assert_eq!(Preferences::default().accent_index(NAMES), 0);+ }++ /// A remembered name finds its row whatever its case or spacing, since+ /// the file is plain JSON somebody may have edited.+ #[test]+ fn accent_matches_by_name_not_by_case() {+ for spelled in ["violet", "Violet", "VIOLET", " violet\n"] {+ let prefs = Preferences {+ accent: Some(spelled.to_owned()),+ ..Preferences::default()+ };+ assert_eq!(prefs.accent_index(NAMES), 2, "{spelled:?}");+ }+ }++ /// A name the list no longer has falls back to the default rather than+ /// to a position, and an empty list cannot be indexed into at all.+ #[test]+ fn unknown_or_empty_accent_falls_back() {+ let prefs = Preferences {+ accent: Some("chartreuse".to_owned()),+ ..Preferences::default()+ };+ assert_eq!(prefs.accent_index(NAMES), 0);+ assert_eq!(prefs.accent_index(Vec::<String>::new()), 0);+ let blank = Preferences {+ accent: Some(String::new()),+ ..Preferences::default()+ };+ assert_eq!(blank.accent_index(NAMES), 0);+ }++ /// The id is what gets written and what gets matched, so the two have+ /// to agree on one spelling.+ #[test]+ fn accent_id_round_trips_through_the_file() {+ let prefs = Preferences {+ accent: Some(Preferences::accent_id("Sky")),+ ..Preferences::default()+ };+ let text = serde_json::to_string(&prefs).unwrap();+ assert!(text.contains("\"accent\":\"sky\""), "{text}");+ let back: Preferences = serde_json::from_str(&text).unwrap();+ assert_eq!(back.accent_index(NAMES), 1);+ }++ /// A hex is a picked colour and a word is not, whatever else is around+ /// it; and a picked colour is no name, so the index falls back to the+ /// default until the caller has parsed it.+ #[test]+ fn a_hash_means_a_picked_colour() {+ let picked = Preferences {+ accent: Some(" #FF00AA ".to_owned()),+ ..Preferences::default()+ };+ assert_eq!(picked.custom_accent(), Some("#FF00AA"));+ assert_eq!(picked.accent_index(NAMES), 0);+ let named = Preferences {+ accent: Some("sky".to_owned()),+ ..Preferences::default()+ };+ assert_eq!(named.custom_accent(), None);+ assert_eq!(Preferences::default().custom_accent(), None);+ let blank = Preferences {+ accent: Some(String::new()),+ ..Preferences::default()+ };+ assert_eq!(blank.custom_accent(), None);+ }++ /// A file from before the accent existed still loads, and reads as the+ /// default.+ #[test]+ fn older_file_without_an_accent_is_lime() {+ let back: Preferences = serde_json::from_str(r#"{"dark": false}"#).unwrap();+ assert_eq!(back.dark, Some(false));+ assert_eq!(back.accent, None);+ assert_eq!(back.accent_index(NAMES), 0);+ }+}diff --git a/src/crates/concat/ui/app.slint b/src/crates/concat/ui/app.slintindex 9d5ff444..774dc3c5 100644--- a/src/crates/concat/ui/app.slint+++ b/src/crates/concat/ui/app.slint@@ -203,6 +203,8 @@ export component App inherits Window {callback settings-show-log();callback settings-language-changed(index: int);callback settings-theme-changed(dark: bool);+ callback settings-accent-changed(index: int);+ callback settings-accent-custom-changed(colour: color);callback settings-playhead-stops-changed(on: bool);callback settings-custom-context-actions-changed(on: bool);callback settings-magnetic-changed(on: bool);@@ -526,6 +528,8 @@ export component App inherits Window {show-log => { root.settings-show-log(); }language-changed(index) => { root.settings-language-changed(index); }theme-changed(dark) => { root.settings-theme-changed(dark); }+ accent-changed(index) => { root.settings-accent-changed(index); }+ accent-custom-changed(colour) => { root.settings-accent-custom-changed(colour); }playhead-stops-changed(on) => { root.settings-playhead-stops-changed(on); }custom-context-actions-changed(on) => { root.settings-custom-context-actions-changed(on); }magnetic-changed(on) => { root.settings-magnetic-changed(on); }diff --git a/src/crates/concat/ui/dialogs/settings.slint b/src/crates/concat/ui/dialogs/settings.slintindex f36b0ae5..6b92e1f0 100644--- a/src/crates/concat/ui/dialogs/settings.slint+++ b/src/crates/concat/ui/dialogs/settings.slint@@ -9,6 +9,8 @@ import { Glyph, Icon } from "../icons.slint";import { Button, DialogRow, DialogSection, Field, Modal, Progress } from "../primitives/modal.slint";import { IconButton } from "../primitives/panel.slint";import { SegmentedControl } from "../primitives/segmented-control.slint";+import { ColorPicker } from "../primitives/color-picker.slint";+import { Fmt } from "../util.slint";import { Select } from "../primitives/select.slint";import { Switch } from "../inspector/controls.slint";import { PaneScroll } from "../workspace/pane.slint";@@ -287,6 +289,57 @@ component ModelRow inherits Rectangle {}}+// One accent on offer: a dot of the colour, and a ring round it while it is+// the one in use. The ring is the text colour rather than the accent — the+// dot already *is* the accent, and a ring in it would just be a bigger dot —+// and it sits off the dot by a gap of the panel, so it reads as a mark round+// the colour and not as a border on it. A hover shows the same ring faintly.+component AccentSwatch inherits Rectangle {+ in property <color> colour;+ /// The colour's name, for whoever cannot see it.+ in property <string> label;+ in property <bool> chosen;+ /// Not a colour yet: the dot wears a plus, cut out in the panel's+ /// colour, to say it is where a colour would go.+ in property <bool> blank;++ callback clicked();++ width: 26px;+ height: 26px;+ border-radius: 13px;+ border-width: 2px;+ border-color: root.chosen ? Theme.fg+ : touch.has-hover ? Theme.line-strong+ : Colors.transparent;++ accessible-role: button;+ accessible-label: root.label;++ animate border-color { duration: 120ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }++ Rectangle {+ width: 16px;+ height: 16px;+ border-radius: 8px;+ background: root.colour;++ animate background { duration: 120ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }++ if root.blank: Icon {+ glyph: Glyph.plus;+ size: 10px;+ weight: 2.6;+ tint: Theme.panel;+ }+ }++ touch := TouchArea {+ mouse-cursor: pointer;+ clicked => { root.clicked(); }+ }+}+component PageTab inherits Rectangle {in property <string> label;in property <Glyph> glyph;@@ -390,6 +443,10 @@ export component SettingsDialog inherits Modal {/// say "the other one"; a page with two named options can say which one is/// on, which is the whole reason it moved in here.callback theme-changed(dark: bool);+ /// The accent, as an index into `Theme.accent-names`.+ callback accent-changed(index: int);+ /// A colour picked by hand in place of any on the list.+ callback accent-custom-changed(colour: color);callback playhead-stops-changed(on: bool);callback custom-context-actions-changed(on: bool);callback magnetic-changed(on: bool);@@ -407,6 +464,16 @@ export component SettingsDialog inherits Modal {callback model-cancel(id: string);callback model-remove(id: string);+ /// `Theme.accent-names`, each in the chosen language, in the same order.+ /// A second list rather than a lookup on the first because the string+ /// inventory (scripts/locales.py) is built from literal calls, and a name+ /// that only ever reached `I18n.t` through a variable would never be+ /// offered to a translator.+ property <[string]> accent-labels: [+ I18n.t("Lime"), I18n.t("Sky"), I18n.t("Violet"),+ I18n.t("Rose"), I18n.t("Amber"), I18n.t("Mint"),+ ];+open: root.data.open;title: I18n.t("Settings");glyph: Glyph.settings;@@ -684,14 +751,94 @@ export component SettingsDialog inherits Modal {// through the struct would be a second copy to keep in step with// the first. The change still goes out as a callback, so Rust// stays the one place a remembered preference will be written.- if root.data.tab == 1: DialogSection {- first: true;- title: I18n.t("Theme");+ if root.data.tab == 1: VerticalLayout {+ DialogSection {+ first: true;+ title: I18n.t("Theme");++ SegmentedControl {+ options: [I18n.t("Dark"), I18n.t("Light")];+ current: Theme.dark ? 0 : 1;+ changed(index) => { root.theme-changed(index == 0); }+ }+ }++ // The accent: the colour every selection, activated tool and+ // focus ring is drawn in. Read off the Theme global for the+ // same reason the theme is, and each one is shown in the+ // palette that is on, so the choice is made in the room it+ // will be worn in. The chosen one's name sits at the end of+ // the row: a dot is a colour, not a word, and the word is+ // what the settings file remembers.+ DialogSection {+ title: I18n.t("Accent");++ HorizontalLayout {+ spacing: 6px;+ alignment: start;++ for name[index] in Theme.accent-names: AccentSwatch {+ colour: Theme.accent-of(index);+ label: root.accent-labels[index];+ chosen: Theme.accent-choice == index;+ clicked => { root.accent-changed(index); }+ }++ // The seventh dot is any colour at all. Grey with a+ // plus until one is picked — a grey dot is a blank,+ // not an offer of grey — and the picked colour once+ // one is. It opens the same picker a title's colour+ // does, seeded with the accent that is on, so the+ // picking starts from what the window already wears.+ Rectangle {+ width: 26px;+ height: 26px;++ AccentSwatch {+ colour: Theme.accent-is-custom ? Theme.accent-custom : Theme.fg-dim;+ label: I18n.t("Custom");+ chosen: Theme.accent-is-custom;+ blank: !Theme.accent-is-custom;+ clicked => { picker.show(); }+ }++ picker := PopupWindow {+ x: 0;+ y: parent.height + 4px;+ width: 236px;+ close-policy: close-on-click-outside;++ Rectangle {+ background: Theme.raised;+ border-width: 1px;+ border-color: Theme.line-strong;+ border-radius: Theme.r;++ ColorPicker {+ value: Theme.accent-is-custom ? Theme.accent-custom : Theme.accent;+ alpha: false;+ changed(next) => { root.accent-custom-changed(next); }+ }+ }+ }+ }- SegmentedControl {- options: [I18n.t("Dark"), I18n.t("Light")];- current: Theme.dark ? 0 : 1;- changed(index) => { root.theme-changed(index == 0); }+ Text {+ text: Theme.accent-is-custom ? I18n.t("Custom")+ : root.accent-labels[Theme.accent-choice];+ color: Theme.fg-muted;+ font-size: Theme.fs;+ vertical-alignment: center;+ }++ if Theme.accent-is-custom: Text {+ text: Fmt.hex-of(Theme.accent-custom, false);+ color: Theme.fg-dim;+ font-family: Theme.font-technical;+ font-size: Theme.fs-sm;+ vertical-alignment: center;+ }+ }}}diff --git a/src/crates/concat/ui/theme/accent.slint b/src/crates/concat/ui/theme/accent.slintnew file mode 100644index 00000000..0800914e--- /dev/null+++ b/src/crates/concat/ui/theme/accent.slint@@ -0,0 +1,18 @@+// SPDX-License-Identifier: AGPL-3.0-or-later+// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors++// One accent: the four colours that have to move together when the accent+// does. Both palettes list theirs as a row of these, in the same order, and+// `Theme` reads the chosen one out by index — so a palette can offer a+// colour without a token per colour, and the ink that sits on it can never+// be left behind when it changes.+export struct Accent {+ /// The colour itself: every selection, activated tool and focus ring.+ accent: color,+ /// The same, under a pointer.+ hover: color,+ /// A wash of it, for the ground of a selected row.+ soft: color,+ /// Ink for text and glyphs sitting ON it.+ on: color,+}diff --git a/src/crates/concat/ui/theme/dark.slint b/src/crates/concat/ui/theme/dark.slintindex 73839a89..a3368572 100644--- a/src/crates/concat/ui/theme/dark.slint+++ b/src/crates/concat/ui/theme/dark.slint@@ -27,8 +27,8 @@// Move them together or not at all. What the ladder is measuring is// prominence, and here prominence happens to run towards white; that is// the one thing about it a light palette cannot copy.-// - `on-accent` is the ink that sits *on* the accent, and it is dark because-// the accent is bright. Swap the accent for a dark one and this has to+// - Each accent's `on` is the ink that sits *on* it, and it is dark because+// the accent is bright. Swap an accent for a dark one and its ink has to// become light in the same edit, or every activated control loses its// label — which is exactly what the light palette does. The same pairing// holds for `on-green` and `on-scrim`.@@ -50,6 +50,8 @@// The clip and media-kind hues and the meter ramp name things the engine and// the project format also name, so they are fixed by what they mean rather// than by the surfaces around them.+import { Accent } from "accent.slint";+export global Dark {// surfaces//@@ -122,20 +124,30 @@ export global Dark {// accents//// Lime, not blue. The two places that carry the look are the selection- // highlight and every activated tool, and both are lime; making it the- // one accent as well says the same thing with one token instead of three.+ // highlight and every activated tool, and both are the accent; making it+ // the one accent as well says the same thing with one token instead of+ // three.//- // It is legible against near-black and near-white alike, which is what a+ // Six to choose from, and Settings › Appearance picks one. The first is+ // the default, and the one the rest of this file means by "lime". Each+ // is legible against near-black and near-white alike, which is what a// selection has to be: it lands on whatever happens to be underneath it.- // What sits *on* it therefore has to be dark ink, and fixed — see- // `on-accent` below.- out property <color> accent: #cbf53f;- out property <color> accent-hover: #d9ff63;- out property <color> accent-soft: #cbf53f33; // rgb(203 245 63 / 0.2)+ // What sits *on* each therefore has to be dark ink, and is fixed with it:+ // `on` is a deep shade of the same hue, `hover` a step brighter, `soft`+ // the colour at 20% for a wash. A dark accent would want #ffffff for its+ // ink instead, which is the light palette's whole answer.+ //+ // The same order as `light.slint` and as `accent-names` in theme.slint,+ // which is where each one's name lives.+ out property <[Accent]> accents: [+ { accent: #cbf53f, hover: #d9ff63, soft: #cbf53f33, on: #15220a }, // lime+ { accent: #5fb8ff, hover: #82c9ff, soft: #5fb8ff33, on: #061c33 }, // sky+ { accent: #b394ff, hover: #c6b0ff, soft: #b394ff33, on: #1d0f3d }, // violet+ { accent: #ff6fa3, hover: #ff8fb8, soft: #ff6fa333, on: #38091c }, // rose+ { accent: #ffb340, hover: #ffc46a, soft: #ffb34033, on: #2d1a00 }, // amber+ { accent: #3fdcc4, hover: #6ae7d4, soft: #3fdcc433, on: #05261f }, // mint+ ];out property <color> green: #30d158;- // Ink for text and glyphs sitting ON the accent. A bright accent needs a- // dark one; a dark accent would want #ffffff here instead.- out property <color> on-accent: #15220a;out property <color> on-green: #06210f;// The Rail's dragger — the raised chip you push along a hairline rail, asdiff --git a/src/crates/concat/ui/theme/light.slint b/src/crates/concat/ui/theme/light.slintindex 522110d7..538594cd 100644--- a/src/crates/concat/ui/theme/light.slint+++ b/src/crates/concat/ui/theme/light.slint@@ -21,12 +21,12 @@// mute/solo pair are `field` buttons inset into one. `field-active` is the// rung that drops below the well, which is right — pressed is recessed.//-// - **The accent comes down.** #cbf53f is a light on a dark ground. On a+// - **The accents come down.** #cbf53f is a light on a dark ground. On a// near-white panel it is a highlighter: illegible as ink, and barely a-// shape as a fill. This takes the same hue to where it can do both jobs —+// shape as a fill. This takes each hue to where it can do both jobs —// dark enough to read as text on the panel, dark enough for white to read-// on it — and `on-accent` flips to white in the same edit, which is-// exactly the pairing the dark palette says has to hold. `green` and+// on it — and every accent's ink flips to white in the same edit, which+// is exactly the pairing the dark palette says has to hold. `green` and// `danger` move for the same reason and by the same amount.//// - **The clips are tinted, not shaded.** Each kind's `-well` is a light@@ -45,6 +45,8 @@// The greys carry a trace of blue as they darken, the way `page` does in the// dark palette. It is what keeps a large field of light grey from going warm// and reading as paper.+import { Accent } from "accent.slint";+export global Light {// surfaces//@@ -89,23 +91,30 @@ export global Light {// accents//- // Still the lime, taken down to where a near-white ground can hold it. At- // this value it clears 4.5:1 against `panel` as ink and white clears 5:1- // on it as a fill, which is what lets one token keep doing both jobs — the- // 41 places that tint a glyph or a border with it and the 26 that fill a- // control with it are the same token, and splitting them into an ink and a- // fill would be a second accent to keep in step.+ // The dark palette's six, each taken down to where a near-white ground+ // can hold it. At these values every one clears 4.5:1 against `panel` as+ // ink and white clears 5:1 on it as a fill, which is what lets one token+ // keep doing both jobs — the 41 places that tint a glyph or a border with+ // it and the 26 that fill a control with it are the same token, and+ // splitting them into an ink and a fill would be a second accent to keep+ // in step.//// Hover goes darker, not lighter: on this ground more contrast is more// engagement, which is the same sentence the dark palette's brighter hover- // is saying.- out property <color> accent: #4d7c0f;- out property <color> accent-hover: #3f680b;- out property <color> accent-soft: #4d7c0f2e; // rgb(77 124 15 / 0.18)+ // is saying. The ink is white on all six, because every one is now dark —+ // the pairing the dark palette insists on, honoured from the other side.+ // `soft` is the colour at 18%.+ //+ // The same order as `dark.slint` and as `accent-names` in theme.slint.+ out property <[Accent]> accents: [+ { accent: #4d7c0f, hover: #3f680b, soft: #4d7c0f2e, on: #ffffff }, // lime+ { accent: #1f66d1, hover: #1a55b0, soft: #1f66d12e, on: #ffffff }, // sky+ { accent: #7239e6, hover: #6030c8, soft: #7239e62e, on: #ffffff }, // violet+ { accent: #cf2468, hover: #b01d58, soft: #cf24682e, on: #ffffff }, // rose+ { accent: #b4530a, hover: #98450a, soft: #b4530a2e, on: #ffffff }, // amber+ { accent: #0f7a6e, hover: #0c665c, soft: #0f7a6e2e, on: #ffffff }, // mint+ ];out property <color> green: #248a3d;- // Light ink, because the accent is now dark — the pairing the dark- // palette's `on-accent` comment insists on, honoured from the other side.- out property <color> on-accent: #ffffff;out property <color> on-green: #ffffff;// The Rail's dragger. White rather than the dark palette's near-white,diff --git a/src/crates/concat/ui/theme/theme.slint b/src/crates/concat/ui/theme/theme.slintindex 45b7db63..64f18fab 100644--- a/src/crates/concat/ui/theme/theme.slint+++ b/src/crates/concat/ui/theme/theme.slint@@ -1,20 +1,23 @@// SPDX-License-Identifier: AGPL-3.0-or-later// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors-// The theme: the two palettes, and the one property that chooses between them.+// The theme: the two palettes, and the two properties that choose from them.//// Everything the interface is made of — every colour, every radius, every// metric, every step of the type scale — is read from `Theme`, and nowhere// else. Nothing outside this directory names a colour. Which colour `Theme`-// hands back depends on `dark`, and that is the whole of the switch.+// hands back depends on `dark`, and for the accent on `accent-choice` as+// well, and that is the whole of the switch.//-// The split across the three files is by what a theme gets to decide:+// The split across the files is by what a theme gets to decide://// - `dark.slint` and `light.slint` are the palettes. Colours only, the same// token names in the same order, and each one complete — no palette// borrows a value from the other. Their headers say what the values mean// and which relationships between them are load-bearing; read the dark-// one first, it is where those rules are written down.+// one first, it is where those rules are written down. Each lists its+// accents as a row of `Accent`s (accent.slint), in the order this file+// names them.// - This file holds the switch, and everything a palette does *not* get to// decide: the type, the shape, and the content colours. A second theme is// a retone, not a redraw — the panels are the same size and the corners@@ -23,8 +26,10 @@// window happened to be wearing.//// To add a third theme: write the palette next door, import it here, and give-// `dark` more than two answers to be. To fork the look wholesale: change the-// values in a palette. Neither one touches a file outside this directory.+// `dark` more than two answers to be. To add an accent: a row in each palette+// and a name in `accent-names`, at the same position. To fork the look+// wholesale: change the values in a palette. None of it touches a file+// outside this directory.//// Two things are deliberately *not* here://@@ -32,6 +37,7 @@// effect does rather than anything a theme decides.// - Sizes under about 5px — a 2px scrollbar thumb, a 1px splitter pill.// Those are shape at a scale nobody themes, and stay where they are drawn.+import { Accent } from "accent.slint";import { Dark } from "dark.slint";import { Light } from "light.slint";@@ -41,6 +47,29 @@ export global Theme {/// the tree is a property read away from it, so the window retones in a/// frame without anything being rebuilt.in-out property <bool> dark: true;+ /// Which of the palettes' accents the accent tokens are read from: an+ /// index into `accent-names`, and into each palette's `accents`.+ /// Settings > Appearance picks it (lib.rs, `on_settings_accent_changed`)+ /// the way it picks `dark`, and it retones the window the same way.+ /// Remembered by name rather than by number, so a list that grows or+ /// reorders keeps everyone's choice; 0 is Lime, the default. One past+ /// the last name is the custom colour, `accent-custom`.+ in-out property <int> accent-choice: 0;+ /// A colour picked by hand in place of any on the list. Read only while+ /// `accent-choice` points past the list, and one colour under both+ /// palettes: whoever picked it picked what they see, and the three+ /// tokens that go with an accent are derived from it below, each by+ /// the palette's own rule. Grey until picked — the dot that offers it+ /// is grey, and a grey accent is what nobody would choose, so it+ /// cannot be mistaken for a choice that was made.+ in-out property <color> accent-custom: #808080;+ /// The chosen accent is the picked one rather than one of the list.+ out property <bool> accent-is-custom: accent-choice >= accent-names.length;+ /// The accents on offer, in the order both palettes list them. Each+ /// name is the English word Settings shows for it, and the id it is+ /// remembered under in settings.json, lower-cased; the dialog holds the+ /// same list wrapped for translation, in this order.+ out property <[string]> accent-names: ["Lime", "Sky", "Violet", "Rose", "Amber", "Mint"];// ── type ─────────────────────────────────────────────────────────────//@@ -131,14 +160,40 @@ export global Theme {out property <color> fg-dim: dark ? Dark.fg-dim : Light.fg-dim;out property <color> fg-hot: dark ? Dark.fg-hot : Light.fg-hot;- // accents- out property <color> accent: dark ? Dark.accent : Light.accent;- out property <color> accent-hover: dark ? Dark.accent-hover : Light.accent-hover;- out property <color> accent-soft: dark ? Dark.accent-soft : Light.accent-soft;+ // accents — the chosen row of the palette that is on, spread into the+ // four tokens the tree has always read.+ //+ // A custom colour has no row, so its three companions are made from it+ // the way each palette makes its own: hover is a step towards more+ // contrast, which is brighter on a dark ground and darker on a light+ // one; soft is the colour at the palette's wash alpha; and the ink on+ // it is dark or light by which of the two the colour itself is not.+ // Perceived lightness rather than the mean of the channels, so a pure+ // green gets dark ink and a pure blue gets light, as they should.+ out property <float> custom-light:+ (0.299 * accent-custom.red + 0.587 * accent-custom.green + 0.114 * accent-custom.blue) / 255;+ out property <Accent> custom-tone: {+ accent: accent-custom,+ hover: dark ? accent-custom.brighter(0.15) : accent-custom.darker(0.15),+ soft: accent-custom.with-alpha(dark ? 0.2 : 0.18),+ on: custom-light > 0.55 ? #16161a : #ffffff,+ };+ out property <Accent> tone: accent-is-custom ? custom-tone+ : dark ? Dark.accents[accent-choice] : Light.accents[accent-choice];+ out property <color> accent: tone.accent;+ out property <color> accent-hover: tone.hover;+ out property <color> accent-soft: tone.soft;+ out property <color> on-accent: tone.on;out property <color> green: dark ? Dark.green : Light.green;- out property <color> on-accent: dark ? Dark.on-accent : Light.on-accent;out property <color> on-green: dark ? Dark.on-green : Light.on-green;+ /// The `index`th accent under the palette that is on, for the row in+ /// Settings that offers them: each is shown as it would be worn, so the+ /// choice is made in the room it will be seen in.+ public pure function accent-of(index: int) -> color {+ return dark ? Dark.accents[index].accent : Light.accents[index].accent;+ }+// the Rail's draggerout property <color> grip: dark ? Dark.grip : Light.grip;out property <color> grip-active: dark ? Dark.grip-active : Light.grip-active;@@ -217,11 +272,18 @@ export global Theme {// They live here rather than beside the control that offers them because// there is exactly one shelf and it belongs to the whole application. The// list is the neutrals first, then the interface's own status hues, then- // the clip palette's marks — both palettes' accents are in it, so the row- // agrees with the window whichever way it is set.+ // the clip palette's marks — the chosen accent under both palettes is in+ // it, so the row agrees with the window whichever way it is set. Those+ // two are the one thing in the shelf that follows a setting, and only+ // which colour is *offered* moves: a title already painted keeps its+ // colour, because the colour is in the document and not in the theme.+ // A custom accent has one colour, not two, so it takes the first slot+ // and the lime keeps the second.out property <[color]> swatches: [#ffffff, #f5f5f7, #a1a1a6, #6e6e73, #15220a, #000000,- #cbf53f, #4d7c0f, #30d158, #ffd60a, #f09e2f, #ff453a,+ accent-is-custom ? accent-custom : Dark.accents[accent-choice].accent,+ accent-is-custom ? Dark.accents[0].accent : Light.accents[accent-choice].accent,+ #30d158, #ffd60a, #f09e2f, #ff453a,#e8355e, #8b5cf6, #4d8df6, #142640,];/// What a title's plate is set to when the switch is turned on. A colour