Skip to main content

Crate dartboard_tui

Crate dartboard_tui 

Source
Expand description

Reusable ratatui widget that renders a dartboard Canvas.

CanvasWidget borrows a CanvasWidgetState and draws the canvas cells, optional selection overlay, and optional floating-selection overlay into a ratatui buffer. The widget carries only styling; per-session view data lives in the state. Each consumer (standalone app, late-sh integration, etc.) builds its own state per render, similar to how ratatui’s Paragraph::new(text).style(...) works.

Structs§

CanvasStyle
Styling hooks for CanvasWidget. Each consumer supplies colors from its own theme. Defaults are sensible for a dark terminal background.
CanvasWidget
Widget that renders the canvas + overlays.
CanvasWidgetState
Per-render data the widget reads. The canvas reference and optional selection/floating views are what make each session’s view distinct.
FloatingView
View of a floating selection pinned to anchor. Consumers pass a flat cells slice of length width * height (row-major). None entries are rendered as background in opaque mode and skipped in transparent mode.
SelectionView
View of an in-flight selection. anchor is the fixed corner, cursor is the moving corner.

Enums§

SelectionShape
Selection shape as it appears to the renderer. Mirrors the shape used by standalone dartboard; kept here (rather than in dartboard-core) because the shape is strictly about how selection is drawn, not how it’s stored.