Skip to main content

Module theme

Module theme 

Source
Expand description

Beam Design Language theme system. The Beam Design Language theme system for photon-ui.

Provides color palettes, semantic tokens, ANSI rendering, and composable text styles for terminal UIs.

§Quick start

use photon_ui::theme::{
    Palette,
    Style,
    Theme,
    stylize,
};

Theme::set(Theme::Light);
let accent = Theme::current().accent();
let styled = stylize("Hello", &Style::new().fg(accent).bold());

§Switching themes on demand

use photon_ui::theme::{
    Palette,
    Theme,
};

Theme::set(Theme::Dark);
assert_eq!(Theme::current().bg_page().to_hex(), "#1f1f1f");

Theme::set(Theme::Light);
assert_eq!(Theme::current().bg_page().to_hex(), "#fffaed");

Re-exports§

pub use ansi::ColorMode;
pub use ansi::RESET;
pub use ansi::bg;
pub use ansi::fg;
pub use color::Color;
pub use palette::Palette;
pub use palette::Theme;
pub use style::Style;
pub use style::stylize;
pub use style::stylize_padded;

Modules§

ansi
ANSI escape sequence generation for RGB colors.
color
Raw RGB color definitions for the Beam Design Language palette.
palette
Semantic color tokens for the Beam Design Language.
style
Composite text styles for terminal rendering.