Crates.io | cod |
lib.rs | cod |
version | 9.0.3 |
source | src |
created_at | 2022-08-28 17:45:16.918436 |
updated_at | 2024-06-29 07:17:50.506327 |
description | A mini, functional terminal drawing utility. |
homepage | https://github.com/Kyllingene/cod |
repository | https://github.com/Kyllingene/cod |
max_upload_size | |
id | 653994 |
size | 41,889 |
Cod is a lightweight, (almost) zero-dependency command-line drawing utility. It works much like a basic C library, where you call functions to produce effects on the screen, rather than use a struct or some fancy macro syntax. However, it provides several conveniences above the ordinary C lib:
cod::style::bold()
and cod::color::with()
style::with::bold(|| {...})
read::key()
or read::line()
crossterm
crossterm
crossterm
There are some examples in the examples
directory, but as cod aims to be as
simple to use as possible, they aren't prioritized. Moreover, everything in cod
is well-documented, so it's arguably easier to just look through the docs!
Note: most cod functions don't flush stdout, so if you run into issues, try that!
You may notice that while there are separate functions for enabling bold and
faint, they both share de::weight
. That's because, true to ANSI form,
terminals and VTE's can't agree on it, so we're stuck with only one way to
disable both. That goes for both with::bold
and with::faint
as well!
Additionally, on some terminals, bold and faint are mutually exclusive. On
some, like Alacritty, they can coexist only if the text is uncolored. In
general, be careful when using both at the same time. You can use the
bold-faint
example to test your terminal.