Skip to main content

Crate egui_sgr

Crate egui_sgr 

Source
Expand description

Convert ANSI/SGR text into egui text representations.

The primary output is egui::text::LayoutJob, because ANSI text is a single logical string with style changes inside it.

use egui_sgr::{ansi_to_layout_job, EguiAnsiTheme};

let theme = EguiAnsiTheme::default();
let job = ansi_to_layout_job("\x1b[31mred\x1b[0m default", &theme);
assert_eq!(job.text, "red default");

Structs§

AnsiSpan
A visible run of text with one ANSI style.
AnsiSpanBuffer
Accumulates streamed ANSI spans and can render the full buffer to egui.
AnsiStreamParser
Stateful streaming ANSI parser.
AnsiStyle
Complete style state for an ANSI span.
EguiAnsiTheme
Theme used when converting ANSI spans into egui text formats.

Enums§

AnsiColor
ANSI color representation before it is mapped into an egui color.
AnsiIntensity
ANSI text intensity.
UnderlineStyle
ANSI underline style.

Functions§

ansi_bytes_to_layout_job
Converts bytes with ANSI escapes directly to an egui layout job.
ansi_bytes_to_spans
Converts bytes into ANSI spans.
ansi_to_layout_job
Converts a UTF-8 string with ANSI escapes directly to an egui layout job.
ansi_to_spans
Converts a UTF-8 string into ANSI spans.
example_usage
Small compile-checked usage sample used by examples and documentation.
spans_to_layout_job
Converts ANSI spans to an egui layout job.