Crates.io | crosstermion |
lib.rs | crosstermion |
version | 0.14.0 |
source | src |
created_at | 2020-07-05 09:46:35.257763 |
updated_at | 2024-02-03 09:40:49.12666 |
description | utilities for `crossterm`, without ties to `termion` |
homepage | |
repository | https://github.com/Byron/tui-crates |
max_upload_size | |
id | 261545 |
size | 29,118 |
Crosstermion is a utility crate to unify some types of both crates, allowing to easily build apps that use the leaner termion
crate on unix systems, but resort to crossterm on windows systems.
Currently provided facilities are:
Key
type an an input_stream
(async) to receive key pressesAltenrativeRawTerminal
which marries an alternative screen with raw modetui
or tui-react
terminal with either the crossterm or the termion backend.tui
tui
, you will have native cross-backend support for colors and styles.tui
color
feature for additional utilities for colors with ansi_term
.ansi_term
, colored
or termcolor
will work as expected.crossterm
on Windows and termion
on Unix?There seems to be no easy way, as cargo
will always build dependencies even though they are not supposed to be used on your platform.
This leads to both termion
and crossterm
to be built, which is fatal on Windows. Thus one will have to manually select feature toggles
when creating a release build, i.e. one would have to exclude all functionality that requires TUIs by default, and let the user enable
the features they require.
The compile_error!(…)
macro can be useful to inform users if feature selection is required. Alternatively, assure that everything compiles
even without any selected backend.
Lastly, one can always give in and always compile against crossterm
.
All features work additively, but in case they are mutually exclusive, for instance
in case of tui-react
and tui
, or crossterm
and termion
, the more general one will be chosen.
Key
conversion support from crossbeam::event::KeyEvent
and an AlternativeRawTerminal
mio
.Key
conversion support from termion::event::Key
and an AlternativeRawTerminal
tui_
(mutually exclusive)
termion
feature
tui
with termion
and provides a tui::Terminal
with termion
backendcrossterm
feature
tui
with crossterm
and provides a tui::Terminal
with crossterm
backendtui-react
(mutually exclusive)
termion
feature
tui-react
with crossterm
and provides a tui::Terminal
with crossterm
backendcrossterm
feature
tui-react
with crossterm
and provides a tui::Terminal
with crossterm
backendansi_term
based conditional coloring. The crate is small, to the point and allows zero-copy drawing
of bytes and UTF-8 string, while supporting Windows 10 as well.