Skip to content

Commit 03451ad

Browse files
committed
docs: apply new structure of inksac
1 parent 7229494 commit 03451ad

File tree

1 file changed

+51
-32
lines changed

1 file changed

+51
-32
lines changed

README.md

+51-32
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,80 @@
33
[![rust-clippy](https://github.com/SkuldNorniern/inksac-rs/actions/workflows/rust-clippy.yml/badge.svg)](https://github.com/SkuldNorniern/inksac-rs/actions/workflows/rust-clippy.yml)
44
[![rust-audit](https://github.com/SkuldNorniern/inksac-rs/actions/workflows/rust-audit.yml/badge.svg)](https://github.com/SkuldNorniern/inksac-rs/actions/workflows/rust-audit.yml)
55

6-
Inksac is a Rust library that amplifies terminal outputs by offering a seamless integration with ANSI color support. It is devised to be uncomplicated, flexible, and delightful to utilize, adding a splash of color to your terminal applications.
6+
Inksac is a Rust library that amplifies terminal outputs by offering a seamless integration with ANSI color support. It is designed to be uncomplicated, flexible, and delightful to use, adding a splash of color to your terminal applications.
77

88
## Features
99

10-
1. **Check ANSI Color Support**: Before painting your terminal with vibrant colors, ascertain if the current terminal supports ANSI colors using Inksac's built-in function.
10+
1. **ANSI Color Support Detection**: Automatically detect terminal color support levels including True Color support.
1111

12-
2. **Customizable Styles**: Inksac allows the creation of distinct text styles with customizable foreground and background colors, giving a personal touch to your terminal display.
12+
2. **Rich Text Styling**:
13+
- Foreground and background colors
14+
- Basic colors (Black, Red, Green, Yellow, Blue, Magenta, Cyan, White)
15+
- RGB and HEX color support
16+
- Text formatting: Bold, Dim, Italic, Underline
1317

14-
3. **Vivid Text Outputs**: Enrich your terminal applications with colorful text outputs using the `ColoredString` structure.
18+
3. **Color Manipulation**:
19+
- Color lightening and darkening
20+
- RGB color interpolation
21+
- Gradient effects
1522

16-
4. **True Color Support**: Experience the diversity of colors with Inksac supporting true color by RGB and HEX values.
23+
4. **Flexible API**:
24+
- Builder pattern for style creation
25+
- Trait-based styling with `Styleable`
26+
- Error handling with proper Result types
1727

18-
5. **Text Format Options**: Beautify your text with bold, dim, italic, underline formats. Stay tuned for more format options in future releases.
19-
20-
## Usage
21-
22-
Here is a basic example demonstrating how to utilize the Inksac crate:
28+
## Examples
2329

30+
### Basic Usage
2431
```rust
25-
use inksac::is_color_available;
26-
use inksac::types::{Color, ColoredString, Style};
27-
28-
fn main() {
29-
// Check if the terminal supports ANSI colors
30-
match is_color_available() {
31-
Ok(_) => println!("Terminal supports ANSI colors"),
32-
Err(err) => println!("{}", err),
33-
}
34-
35-
// Create a style using the new builder pattern
36-
let title_style = Style::builder()
37-
.foreground(Some(Color::Green))
38-
.background(Some(Color::Red))
32+
use inksac::{Color, Style, Styleable};
33+
34+
fn main() -> Result<(), Box<dyn std::error::Error>> {
35+
let style = Style::builder()
36+
.foreground(Color::Green)
3937
.bold()
4038
.build();
4139

42-
// Create a ColoredString with the predefined style
43-
let title_text = ColoredString::new("Hello World", title_style);
44-
45-
// Print the ColoredString
46-
println!("{}", title_text);
40+
println!("{}", "Hello, Colorful World!".style(style));
41+
Ok(())
4742
}
4843
```
4944

45+
### Styled Error Messages
46+
```rust
47+
use inksac::{Color, Style, Styleable};
48+
49+
let error_style = Style::builder()
50+
.foreground(Color::Red)
51+
.bold()
52+
.build();
53+
54+
println!("{}: {}", "ERROR".style(error_style), "Operation failed");
55+
```
56+
5057
## Installation
5158

52-
To add Inksac as a dependency to your project, run the following command:
59+
Add Inksac to your project:
5360

5461
```sh
5562
cargo add inksac
5663
```
5764

58-
## Disclaimer
65+
## Examples
66+
67+
Check out the [examples directory](./examples) for more detailed examples including:
68+
- Error message styling
69+
- Rainbow text effects
70+
- Progress bars with gradients
71+
- Formatted tables
72+
- Color support detection
73+
74+
## Platform Support
5975

60-
Please note that the actual color representation may vary based on the terminal's capabilities and might not function as anticipated on all platforms.
76+
Inksac automatically detects terminal capabilities and adjusts its output accordingly. The actual color representation may vary based on:
77+
- Terminal emulator capabilities
78+
- Operating system
79+
- Color support level (Basic, 256 colors, True Color)
6180

6281
---
6382
Happy Coding!

0 commit comments

Comments
 (0)