Styles
Use Styles when the question is how terminal cells look:
- foreground and background color;
- bold, dim, italic, blinking, reverse, hidden, and strikethrough attributes;
- underline shape and color; and
- OSC 8 hyperlinks.
Styles do not decide where content goes or how much space it receives. Go to
Layout for margin, borders, padding, dimensions,
alignment, rows, columns, grids, and viewports. The layout API includes a type
named BlockStyle, but its geometry belongs under Layout in this documentation
because that is the task it solves.
Use Themes when appearance expresses application meaning such as success, warning, selected, or focused.
See the appearance controls
Section titled “See the appearance controls”green foreground yellow background bold · italicColors and attributes Foreground, background, emphasis, reverse, hide, and strikethrough.
single double curlyUnderline shape and color Single, double, curly, dotted, and dashed underlines.
Open documentation ↗Terminal hyperlinks OSC 8 targets with a readable fallback on unsupported output.fallback: same label
Run the complete Styles quickstart ↓
Quickstart
Section titled “Quickstart”Create a project and install Urushi:
cargo new style-democd style-democargo add urushiReplace src/main.rs with:
use std::io;
use urushi::{Color, StyledText, TextStyle};
fn main() -> io::Result<()> { let text = StyledText::new( "ready", TextStyle::new().foreground(Color::GREEN).bold(), );
urushi::println(&text)}Run it with cargo run:
Rendered output
ready
TextStyle travels with the text instead of writing raw ANSI into the string.
The renderer keeps the content usable when a terminal or redirected stream
does not support a requested capability.