The README opens on the animated wordmark, says how Luxe is built, and CONTRIBUTING asks contributors to disclose AI help
- The README's wordmark is an animated GIF with a transparent background, rendered from the dashboard's own art and lights, in light and dark variants for GitHub's two themes. - The README says Luxe is built with AI assistance, much of it Luxe working on itself, and CONTRIBUTING has an AI-assistance section: say what helped, understand the change, write to people in your own words. - The redaction table's Google-key example is joined at compile time, so secret scanning stops reading the invented value as a leaked key. - The MCP trust tests read Luxe's own report of what it started, so a slow runner can neither fail them nor pass them falsely.
This commit is contained in:
@@ -42,6 +42,11 @@ use std::time::Duration;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::time::interval;
|
||||
|
||||
/// The animation tick, about 30 a second: what every timed effect counts in, the wordmark's lights
|
||||
/// and the spinner included. Public so a recording of one, the README's wordmark, keeps the same
|
||||
/// time.
|
||||
pub const ANIMATION_TICK: Duration = Duration::from_millis(33);
|
||||
|
||||
/// Why the TUI returned control to the CLI.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum TuiExit {
|
||||
@@ -181,7 +186,7 @@ pub async fn run(
|
||||
let mut sources = Sources {
|
||||
event_rx,
|
||||
terminal_events: Some(EventStream::new()),
|
||||
tick: interval(Duration::from_millis(33)), // ~30fps
|
||||
tick: interval(ANIMATION_TICK),
|
||||
// One listener for the run, rather than a fresh registration on every pass of a loop that
|
||||
// turns over as fast as the terminal can deliver keys.
|
||||
interrupted: Box::pin(tokio::signal::ctrl_c()),
|
||||
|
||||
@@ -34,7 +34,8 @@ pub use slab::{
|
||||
pub use tool_glyph::{tool_glyph, tool_icon, GENERIC_TOOL};
|
||||
pub use wordmark::{
|
||||
banner_frame_due, render_wordmark, smoothstep, BannerClock, Wordmark, WordmarkInk, BAND,
|
||||
DRIFT_DEPTH, LEAN, PEAK_DARK, PEAK_LIGHT, SHINE_CYCLE_TICKS, SHINE_SWEEP_TICKS, STILL_TICK,
|
||||
DRIFT_DEPTH, DRIFT_FRAME_TICKS, DRIFT_PERIOD_TICKS, LEAN, PEAK_DARK, PEAK_LIGHT,
|
||||
SHINE_CYCLE_TICKS, SHINE_SWEEP_TICKS, STILL_TICK,
|
||||
};
|
||||
pub use wrap::{wrap_cells, wrap_line, wrap_lines, wrapped_row_starts};
|
||||
|
||||
|
||||
@@ -23,8 +23,11 @@
|
||||
//! wordmark in the flat accent and skip both rather than approximate them.
|
||||
|
||||
mod art;
|
||||
mod light;
|
||||
|
||||
use art::{column_groups, FULL_ART, LINE_ART, SMALL_ART};
|
||||
pub use light::smoothstep;
|
||||
use light::{blend_toward, Pass};
|
||||
use ratatui::layout::{Alignment, Rect};
|
||||
use ratatui::style::{Color, Modifier, Style};
|
||||
use ratatui::text::{Line, Span};
|
||||
@@ -194,14 +197,23 @@ impl Wordmark {
|
||||
/// A still is a frame of the same animation rather than a separate code path, so what a reader
|
||||
/// sees with `banner_animation = false` is a moment of what everyone else sees moving.
|
||||
pub fn lines(self, ink: WordmarkInk, tick: Option<u64>) -> Vec<Line<'static>> {
|
||||
let (tick, pass) = match tick {
|
||||
Some(tick) => (tick, Pass::at(self, ink, tick)),
|
||||
None => (STILL_TICK, None),
|
||||
};
|
||||
match tick {
|
||||
Some(tick) => self.lines_at(ink, tick, Some(tick)),
|
||||
None => self.lines_at(ink, STILL_TICK, None),
|
||||
}
|
||||
}
|
||||
|
||||
/// The logotype's rows with each light set on its own: the drift at `drift`, and the shine at
|
||||
/// `shine`, or none when that is `None`.
|
||||
///
|
||||
/// The terminal runs both from one clock and keeps them out of step on purpose, so its pattern
|
||||
/// takes minutes to repeat. A recording has to loop, so it sets the two to meet.
|
||||
pub fn lines_at(self, ink: WordmarkInk, drift: u64, shine: Option<u64>) -> Vec<Line<'static>> {
|
||||
let pass = shine.and_then(|tick| Pass::at(self, ink, tick));
|
||||
self.rows()
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(row, text)| self.row_line(text, row as u16, ink, tick, pass.as_ref()))
|
||||
.map(|(row, text)| self.row_line(text, row as u16, ink, drift, pass.as_ref()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -412,78 +424,13 @@ pub fn render_wordmark(
|
||||
pub const SHINE_SWEEP_TICKS: u64 = SWEEP_TICKS;
|
||||
/// One pass plus its rest, in ticks.
|
||||
pub const SHINE_CYCLE_TICKS: u64 = CYCLE_TICKS;
|
||||
/// One whole pass of the drift, in ticks.
|
||||
pub const DRIFT_PERIOD_TICKS: u64 = DRIFT_TICKS;
|
||||
/// Ticks between drift frames while no shine runs.
|
||||
pub const DRIFT_FRAME_TICKS: u64 = DRIFT_FRAME;
|
||||
|
||||
fn shine_active(tick: u64) -> bool {
|
||||
tick % CYCLE_TICKS < SWEEP_TICKS
|
||||
}
|
||||
|
||||
/// One tick of one pass: where the highlight band sits, and how hard it pushes.
|
||||
struct Pass {
|
||||
center: f32,
|
||||
half: f32,
|
||||
peak: f32,
|
||||
lean: f32,
|
||||
}
|
||||
|
||||
impl Pass {
|
||||
/// The pass in flight at `tick`, or `None` while the logotype rests.
|
||||
fn at(size: Wordmark, ink: WordmarkInk, tick: u64) -> Option<Self> {
|
||||
let phase = tick % CYCLE_TICKS;
|
||||
if phase >= SWEEP_TICKS {
|
||||
return None;
|
||||
}
|
||||
let span = size.span();
|
||||
let half = (span * BAND).max(1.0);
|
||||
let travel = span + 2.0 * half;
|
||||
let progress = phase as f32 / SWEEP_TICKS as f32;
|
||||
|
||||
Some(Self {
|
||||
// The band starts and ends clear of the letters, so a pass arrives and leaves rather
|
||||
// than appearing half-drawn across them.
|
||||
center: -half + progress * travel,
|
||||
half,
|
||||
peak: if ink.dark { PEAK_DARK } else { PEAK_LIGHT },
|
||||
lean: LEAN,
|
||||
})
|
||||
}
|
||||
|
||||
/// How far this cell is lifted toward the highlight.
|
||||
fn lift(&self, column: u16, row: u16) -> f32 {
|
||||
let axis = f32::from(column) + self.lean * f32::from(row);
|
||||
let distance = ((axis - self.center).abs() / self.half).min(1.0);
|
||||
smoothstep(1.0 - distance) * self.peak
|
||||
}
|
||||
}
|
||||
|
||||
/// Smooth 0→1 with zero slope at both ends, so a band edge has no seam.
|
||||
///
|
||||
/// The shape of the highlight, and the whole reason it reads as light rather than as a stripe: a
|
||||
/// linear falloff leaves a crease along the ridge and a hard shoulder at each edge. Public so the
|
||||
/// website samples this curve rather than approximating it.
|
||||
pub fn smoothstep(t: f32) -> f32 {
|
||||
let t = t.clamp(0.0, 1.0);
|
||||
t * t * (3.0 - 2.0 * t)
|
||||
}
|
||||
|
||||
/// Alpha-blend `base` `amount` of the way toward `target`.
|
||||
///
|
||||
/// An ANSI/indexed palette has no channels to mix, so an unblendable color comes back untouched
|
||||
/// rather than as an invented RGB approximation of the terminal's own.
|
||||
fn blend_toward(base: Color, target: Color, amount: f32) -> Color {
|
||||
let (Color::Rgb(red, green, blue), Color::Rgb(tr, tg, tb)) = (base, target) else {
|
||||
return base;
|
||||
};
|
||||
if amount <= 0.0 {
|
||||
return base;
|
||||
}
|
||||
let amount = amount.clamp(0.0, 1.0);
|
||||
let lift = |channel: u8, toward: u8| {
|
||||
(f32::from(channel) + (f32::from(toward) - f32::from(channel)) * amount)
|
||||
.round()
|
||||
.clamp(0.0, 255.0) as u8
|
||||
};
|
||||
Color::Rgb(lift(red, tr), lift(green, tg), lift(blue, tb))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
75
crates/luxe-tui/src/widgets/wordmark/light.rs
Normal file
75
crates/luxe-tui/src/widgets/wordmark/light.rs
Normal file
@@ -0,0 +1,75 @@
|
||||
//! Light — the shine's band, the curve it falls off along, and the blend both lights paint with.
|
||||
//!
|
||||
//! The math of the two lights on their own, apart from the art they land on: the parent decides
|
||||
//! which cells are ink and asks here how far each one is lifted.
|
||||
|
||||
use super::{Wordmark, WordmarkInk, BAND, CYCLE_TICKS, LEAN, PEAK_DARK, PEAK_LIGHT, SWEEP_TICKS};
|
||||
use ratatui::style::Color;
|
||||
|
||||
/// One tick of one pass: where the highlight band sits, and how hard it pushes.
|
||||
pub(super) struct Pass {
|
||||
center: f32,
|
||||
half: f32,
|
||||
peak: f32,
|
||||
lean: f32,
|
||||
}
|
||||
|
||||
impl Pass {
|
||||
/// The pass in flight at `tick`, or `None` while the logotype rests.
|
||||
pub(super) fn at(size: Wordmark, ink: WordmarkInk, tick: u64) -> Option<Self> {
|
||||
let phase = tick % CYCLE_TICKS;
|
||||
if phase >= SWEEP_TICKS {
|
||||
return None;
|
||||
}
|
||||
let span = size.span();
|
||||
let half = (span * BAND).max(1.0);
|
||||
let travel = span + 2.0 * half;
|
||||
let progress = phase as f32 / SWEEP_TICKS as f32;
|
||||
|
||||
Some(Self {
|
||||
// The band starts and ends clear of the letters, so a pass arrives and leaves rather
|
||||
// than appearing half-drawn across them.
|
||||
center: -half + progress * travel,
|
||||
half,
|
||||
peak: if ink.dark { PEAK_DARK } else { PEAK_LIGHT },
|
||||
lean: LEAN,
|
||||
})
|
||||
}
|
||||
|
||||
/// How far this cell is lifted toward the highlight.
|
||||
pub(super) fn lift(&self, column: u16, row: u16) -> f32 {
|
||||
let axis = f32::from(column) + self.lean * f32::from(row);
|
||||
let distance = ((axis - self.center).abs() / self.half).min(1.0);
|
||||
smoothstep(1.0 - distance) * self.peak
|
||||
}
|
||||
}
|
||||
|
||||
/// Smooth 0→1 with zero slope at both ends, so a band edge has no seam.
|
||||
///
|
||||
/// The shape of the highlight, and the whole reason it reads as light rather than as a stripe: a
|
||||
/// linear falloff leaves a crease along the ridge and a hard shoulder at each edge. Public so the
|
||||
/// website samples this curve rather than approximating it.
|
||||
pub fn smoothstep(t: f32) -> f32 {
|
||||
let t = t.clamp(0.0, 1.0);
|
||||
t * t * (3.0 - 2.0 * t)
|
||||
}
|
||||
|
||||
/// Alpha-blend `base` `amount` of the way toward `target`.
|
||||
///
|
||||
/// An ANSI/indexed palette has no channels to mix, so an unblendable color comes back untouched
|
||||
/// rather than as an invented RGB approximation of the terminal's own.
|
||||
pub(super) fn blend_toward(base: Color, target: Color, amount: f32) -> Color {
|
||||
let (Color::Rgb(red, green, blue), Color::Rgb(tr, tg, tb)) = (base, target) else {
|
||||
return base;
|
||||
};
|
||||
if amount <= 0.0 {
|
||||
return base;
|
||||
}
|
||||
let amount = amount.clamp(0.0, 1.0);
|
||||
let lift = |channel: u8, toward: u8| {
|
||||
(f32::from(channel) + (f32::from(toward) - f32::from(channel)) * amount)
|
||||
.round()
|
||||
.clamp(0.0, 255.0) as u8
|
||||
};
|
||||
Color::Rgb(lift(red, tr), lift(green, tg), lift(blue, tb))
|
||||
}
|
||||
Reference in New Issue
Block a user