Crate overture

Crate overture 

Source
Expand description

ยง๐ŸŽผ Overture

Overture is an experimental, opinionated, and ergonomic middleware for building high-performance text-based user interfaces (TUIs) in Rust. It offers a clean rendering pipeline built around composable primitives, predictable layout behavior, and ANSI-compatible styling.

ยงโœจ Highlights

  • Composable rendering engine via the Renderable trait.
  • Structured ANSI styling with type-safe escape sequences.
  • Protected pixels to prevent important UI elements from being pruned.
  • Flexible layout placement, including alignment presets and coordinate offsets.
  • Modern design patterns inspired by SwiftUI, TUI toolkits, and declarative UI systems.

ยง๐Ÿ“ฆ Modules

  • engine โ€” The core rendering engine (OvertureRenderEngine).
  • interfaces โ€” Traits, data structures, and abstraction interfaces.
  • ioopts โ€” ANSI terminal options: styling, cursor control, etc.
  • primitives โ€” UI shapes, boxes, and composition-ready widgets.
  • prelude โ€” Common types and traits for quick use.

ยง๐Ÿ” Example

use overture::prelude::*;
 
let cols = 100; let rows = 20;
let mut engine = OvertureRenderEngine::new(cols, rows - 2);
let screen_dim = DiscreteCoord::new(cols, rows);
 
let banner = primitives::text::Text::new("Welcome To", DiscreteCoord::ORIGIN)
    .rasterize()
    .prune()
    .align(RenderPlacementConfig::CenterStage, screen_dim)
    .translate(Translation::new(0, -5))
    .style(style![ANSISequence::FgMagenta, ANSISequence::Bold]);

let brand = primitives::text::Text::new("Overture", DiscreteCoord::ORIGIN)
    .ascii_art_by_name("larry3d")
    .rasterize()
    .prune()
    .align(RenderPlacementConfig::CenterStage, screen_dim)
    .translate(Translation::new(0, 2))
    .style(style![ANSISequence::FgMagenta, ANSISequence::Bold]);
 
let box_frame = primitives::shape::SoftBox::new(
    DiscreteCoord::new(0, 0),
    DiscreteCoord::new(cols - 1, rows - 1)
);
 
engine.load_renderable(banner, None);
engine.load_renderable(brand, None);
engine.load_renderable(box_frame, None);
engine.render(rows as u16);

This example creates a centered styled text banner and surrounds it with a soft box frame. Each UI element is built using method chaining, enabling fluent configuration.

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚                                            Welcome To                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚               _____                               __                                             โ”‚
โ”‚              /\  __`\                            /\ \__                                          โ”‚
โ”‚              \ \ \/\ \    __  __     __    _ __  \ \ ,_\   __  __   _ __     __                  โ”‚
โ”‚               \ \ \ \ \  /\ \/\ \  /'__`\ /\`'__\ \ \ \/  /\ \/\ \ /\`'__\ /'__`\                โ”‚
โ”‚                \ \ \_\ \ \ \ \_/ |/\  __/ \ \ \/   \ \ \_ \ \ \_\ \\ \ \/ /\  __/                โ”‚
โ”‚                 \ \_____\ \ \___/ \ \____\ \ \_\    \ \__\ \ \____/ \ \_\ \ \____\               โ”‚
โ”‚                  \/_____/  \/__/   \/____/  \/_/     \/__/  \/___/   \/_/  \/____/               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

For a full demo, see demo::test().

ยงโš ๏ธ Status

Overture is currently under active development. APIs may change rapidly. Not production-ready, but already expressive for hobby or experimental TUI rendering.

ยงยฉ License

Makabaka1880, 2025. All rights reserved.

Modulesยง

engine
Overture Render Engine
interfaces
The interfaces module defines core building blocks for rendering.
ioopts
IO Options Module
prelude
Commonly used traits and types for Overture. Users can use overture::prelude::* to bring these into scope.
primitives
The primitives module provides fundamental building blocks for the Overture project.

Macrosยง

renderable_list
Constructs a RenderableList using a list of renderable expressions.
some
A convenience macro for Some(expr).
style
Constructs a RenderStyle by chaining style elements.