[−][src]Crate yew_ansi
ANSI escape code rendering for the web
Yew
html! { <AnsiStatic text="Hello \u{001b}[32mWorld\u{001b}[39;1m!" /> }
This will generate the following output (whitespace added for clarity):
<pre style="font-family: monospace">
<span>Hello </span>
<span style="color:#00ff00;">World</span>
<span style="font-weight:bold;">!</span>
</pre>
Refer to AnsiRenderer
and AnsiProps
for more details.
Parsing
If you want to parse text containing ANSI escape codes you can use get_sgr_segments
to iterate over text segments along with their SgrEffect
.
If you need more control, use get_markers
to iterate over the raw Escape
codes in the text.
Structs
AnsiProps | Props that can be passed to the |
AnsiRenderer | Component for rendering text containing ANSI escape codes. |
CharCursor | Cursor for characters in a string slice. |
ClassStyle | Combination of classes and inline styles. |
InlineStyle | Style builder using only inline style attributes. |
MarkerIter | Iterator yielding markers in a string. |
SgrEffect | Describes the effect that multiple SGR parameters have on text. |
SgrSegmentIter | Iterator over the SGR segments in a string slice. |
Enums
ColorEffect | Describes the color effect of multiple SGR parameters. |
ColorName | The 8 colors defined by the original specification. |
Csi | Control sequence. |
Escape | ANSI Escape Sequence. |
Marker | Parts of a string containing ANSI escape sequences. |
Sgr | Select Graphic Rendition parameter. |
Traits
StyleBuilder | Builder for |
Functions
get_markers | Iterate over all |
get_sgr_segments | Create an iterator which iterates over SGR segments in a string slice.
Each item consists of a |
read_next_sequence | Read the next sequence in the given slice.
Returns the content before the escape sequence, the escape sequence itself, and everything following it.
The escape sequence can be |
Type Definitions
Ansi | ANSI component which takes a |
AnsiRc | ANSI component which takes a |
AnsiStatic | ANSI component which takes a |