banner

Startup banner molecule with gradient ASCII art and optional author/version lines.

const ASCII_ART

source

const ASCII_ART: [&str; 6] = [
  " ██████╗ ███████╗███████╗████████╗",
  "██╔════╝ ██╔════╝██╔════╝╚══██╔══╝",
  "██║  ███╗█████╗  ███████╗   ██║",
  "██║   ██║██╔══╝  ╚════██║   ██║",
  "╚██████╔╝███████╗███████║   ██║",
  " ╚═════╝ ╚══════╝╚══════╝   ╚═╝",
];

ASCII block-art rows for the GEST logo.

const ROW_COUNT

source

const ROW_COUNT: usize = ASCII_ART.len();

Total number of rows in the ASCII art, used to compute gradient interpolation.

const SHADOW_CHARS

source

const SHADOW_CHARS: &[char] = &['╗', '╚', '╝', '╔', '║'];

Box-drawing characters rendered with the shadow color for depth effect.

struct Component

source

pub struct Component

Renders the application startup banner with gradient ASCII art and optional author and version lines.

Field Type Description
show_author bool Whether to print the by @aaronmallen line under the art.
show_version bool Whether to print the version, platform, build date and git revision line.

Implements Display.

Component::new

source

pub fn new() -> Self

Create a banner with no optional lines enabled.

Parameter Type Description
returns Self A banner that shows only the ASCII art.

Component::with_author

source

pub fn with_author(self) -> Self

Enable the author attribution line beneath the ASCII art.

Parameter Type Description
returns Self The banner with the author line on.

Component::with_version

source

pub fn with_version(self) -> Self

Enable the version info line beneath the ASCII art.

Parameter Type Description
returns Self The banner with the version line on.

fn fg_color

source

fn fg_color(style: &Style) -> Color

Extracts the foreground color from a style, defaulting to white.

Parameter Type Description
style &Style the theme style to read
returns Color Its foreground color, or Color::White when it has none.

fn lerp_color

source

fn lerp_color(start: Color, end: Color, t: f32) -> Color

Linearly interpolates between two RGB colors. Falls back to start for non-RGB variants.

Parameter Type Description
start Color the color at t = 0
end Color the color at t = 1
t f32 the position between them, from 0 to 1
returns Color The blended color, each channel truncated to a whole number; start unless both colors are RGB.