Iridescent
Features
iridescent is a library for styling terminal text easily. It supports basic
ANSI sequences, Xterm-256 colors, and RGB. You can operate directly on
&str and String types without needing to worry about conversions. It is
important to note that not all terminals support all features. While most
modern terminals will support up to true RGB colors, certain text modes, such as
blink, are not reliable.
Usage
[]
= { = "0.2" }
The only requirement is that you import the Styled trait into the module you
plan on using library methods. Once you have declared it at the top of your module,
the methods will be available on all &str and String types.
Note that all Styled methods can be chained, as seen in the example above
where first we call the foreground method, followed by the bold method. These do
not have to be in any specific order.
Using Basic Colors
use ;
Using 256-bit & RGB Colors
use ;
Hexadecimal Colors
As of v0.2, you can now use hexadecimal color literals now, as well!
use ;
See here for all the methods available.
Examples
If you have cloned the iridescent repository, you can run an example with the
command cargo run --example <example_name>. You can add features, if needed,
with --features <feature_name>.
| Example | File | Description | Features |
|---|---|---|---|
| rainbow | colors.rs | Shows off all base colors in the terminal. | |
| rgb | rainbow.rs | Shows off both 8-bit and 24-bit depth randomized colors in the terminal. | random |
| modes | modes.rs | Shows off the various text modes in the terminal. |
Feature Flags
| Flag | Default | Description | Dependencies |
|---|---|---|---|
random |
Disabled | Enables the use of Color::random() and Color::random_rgb() |
rand |
License
Iridescent is dual-licensed under either
at your option.