2026-10-17 12:08:30 -05:00
|
|
|
//! Modes, drawn — the composer's title, and the color a mode lends the surfaces around it.
|
|
|
|
|
//!
|
|
|
|
|
//! The mode itself is the engine's ([`luxe_core::mode`]); this is only how the TUI shows it. One
|
|
|
|
|
//! rule decides which surfaces take the mode's color: the composer, whatever grows out of it, and
|
|
|
|
|
//! whatever the agent puts in front of you. That is the `/` and `@` menus, the question picker and
|
|
|
|
|
//! the permission prompt. Everything else keeps the accent, so the color always means "where your
|
|
|
|
|
//! words go, and what the agent may do with them".
|
|
|
|
|
|
|
|
|
|
use crate::glyphs::Icon;
|
|
|
|
|
use crate::theme::styles::ThemeStyles;
|
|
|
|
|
use ratatui::style::Style;
|
|
|
|
|
use std::borrow::Cow;
|
|
|
|
|
|
Luxe 0.1.3: your sessions on your phone, joinable sessions, and nested AGENTS.md
- luxe remote puts the sessions on your computer in reach of your own phone or tablet over
Tailscale: write, steer, answer prompts, send photos, browse files, diffs and GitHub, with a
paired device and your own Tailscale login.
- luxe join lets another program on the same machine join a running session over the RPC protocol.
- An AGENTS.md in a subfolder reaches the model the first time it works there.
- Long sessions stay fast: no stall before each model call, lighter memory, cheaper drawing.
- A session is open in one Luxe at a time, web_search shares results across its phrasings, and a
grep glob starting with ! excludes.
The CHANGELOG has the full list.
2026-10-20 02:40:13 -05:00
|
|
|
/// The icon beside a mode's name, here and on the phone app's mode button.
|
|
|
|
|
pub fn icon(mode: &str) -> Icon {
|
2026-10-17 12:08:30 -05:00
|
|
|
match mode {
|
|
|
|
|
luxe_core::mode::PLAN => Icon::ModePlan,
|
|
|
|
|
_ => Icon::ModeBuild,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The color a mode's composer border and title wear.
|
|
|
|
|
///
|
|
|
|
|
/// Plan wears its own; every other mode, a custom one included, wears the border accent every
|
2026-10-20 13:51:34 -05:00
|
|
|
/// other panel does, as its icon is build's, so a session that never plans looks the way luxe
|
2026-10-17 12:08:30 -05:00
|
|
|
/// always has.
|
|
|
|
|
pub(crate) fn accent(mode: &str, styles: &ThemeStyles) -> Style {
|
|
|
|
|
match mode {
|
|
|
|
|
luxe_core::mode::PLAN => styles.mode_plan,
|
|
|
|
|
_ => styles.border_accent,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The theme, with the border accent swapped for the mode's color.
|
|
|
|
|
///
|
|
|
|
|
/// Borrowed in every mode but plan, so the surfaces that take it cost nothing until somebody plans.
|
|
|
|
|
pub(crate) fn styles<'a>(mode: &str, styles: &'a ThemeStyles) -> Cow<'a, ThemeStyles> {
|
|
|
|
|
if mode != luxe_core::mode::PLAN {
|
|
|
|
|
return Cow::Borrowed(styles);
|
|
|
|
|
}
|
|
|
|
|
let mut tinted = styles.clone();
|
|
|
|
|
tinted.border_accent = accent(mode, styles);
|
|
|
|
|
Cow::Owned(tinted)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests {
|
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
|
|
fn theme() -> ThemeStyles {
|
|
|
|
|
let resolved =
|
|
|
|
|
luxe_core::theme::ThemeRegistry::new().resolve("luxe").expect("the luxe theme");
|
|
|
|
|
ThemeStyles::from_resolved(&resolved, "luxe")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// A session that never plans must look exactly as it did before modes existed.
|
|
|
|
|
#[test]
|
|
|
|
|
fn build_borrows_the_theme_untouched() {
|
|
|
|
|
let theme = theme();
|
|
|
|
|
assert!(matches!(styles(luxe_core::mode::BUILD, &theme), Cow::Borrowed(_)));
|
|
|
|
|
assert_eq!(accent(luxe_core::mode::BUILD, &theme), theme.border_accent);
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-20 13:51:34 -05:00
|
|
|
/// A mode luxe does not know looks like one thing, not half build and half plan.
|
2026-10-17 12:08:30 -05:00
|
|
|
///
|
|
|
|
|
/// The break this catches: the icon fell back to build and the color to plan, so a custom
|
|
|
|
|
/// mode wore build's icon in plan's color.
|
|
|
|
|
#[test]
|
|
|
|
|
fn an_unknown_mode_falls_back_to_build_everywhere() {
|
|
|
|
|
let theme = theme();
|
|
|
|
|
assert!(matches!(icon("review"), Icon::ModeBuild));
|
|
|
|
|
assert_eq!(accent("review", &theme), theme.border_accent);
|
|
|
|
|
assert!(matches!(styles("review", &theme), Cow::Borrowed(_)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn plan_lends_its_color_to_the_border_and_nothing_else() {
|
|
|
|
|
let theme = theme();
|
|
|
|
|
let tinted = styles(luxe_core::mode::PLAN, &theme);
|
|
|
|
|
assert_eq!(tinted.border_accent, theme.mode_plan);
|
|
|
|
|
assert_ne!(tinted.border_accent, theme.border_accent, "plan has to look different");
|
|
|
|
|
assert_eq!(tinted.accent, theme.accent, "keys and cursors keep the accent");
|
|
|
|
|
}
|
|
|
|
|
}
|