Skip to content

subham008/Pealn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pealn

Pealn Icon

Crates.io downloads Crates.io version Crates.io license

Pealn is a Rust library for printing coloured text to make your CLI app beautiful as a Peacock

Pealn Icon

Pealn Icon

Features

  • Fatest Pealn is fastest among other famous ones. see benchmarks
  • Compile time format pealn codes during compile time i,e [red](name) converted to \x1b[38;2;255;0;0m name \x1b[0m during compile time
  • Easy to use Apply modification inside string
  • Pre defined Colors Common colors are already defined
  • Text Styles Add Styles like , bold , italic , underline and more
  • Use RGB colors Apply colors using RGB value

Pealn is an Alternative

Traditional Rust Macro Pealn Macro Alternative
print!() pea!()
println!() pealn!()
write!() pealn_write!()
writeln!() pealn_writeln!()
format!() pealn_format!()
eprint!() pealn_eprint!()
eprintln!() pealn_eprintln!()

Installation

Add Pealn to your Cargo.toml:

[dependencies]
pealn = "0.4"

Add Pealn using Cargo CLI:

cargo add Pealn

print new line with colored and styles

Format

[foreground,background,styles....](text) 

🎨 Available Colors

Name Preview Example Code
Red [red](text)
Green [green](text)
Blue [blue](text)
Yellow [yellow](text)
Cyan [cyan](text)
Purple [purple](text)
Magenta [magenta](text)
Black [black](text)
White [white](text)

Note: Color preview may not render


✨ Available Styles

Style Example Code Description
Bold [bold](text) Bold text
Dim [dim](text) Dim/faint text
Italic [italic](text) Italic text
Underline [underline](text) Underlined text
Blink [blink](text) Blinking text (not always supported)
Reverse [reverse](text) Reverse video
Hidden [hidden](text) Hidden text
Strikethrough [strikethrough](text) Strikethrough

Some styles may not be supported in all terminals.

*Note:Some styles are not supported on every console , like blink,reverse and dim

Examples

To print text with foreground

use pealn::{pealn};
pealn!("[yellow](Hello) [green](World)!");

To print text with background

use pealn::{pealn};
pealn!("[default,yellow](Hello) [default,green](World)!");

you can use RGB color too

 use pealn::{pealn};
 pealn!("[(25,45,78)](Hello) [(34,67,78)](World)!");

To print text with foreground and background

use pealn::{pealn};
pealn!("[yellow,white](Hello) [green,white](World)!");

First color defined is always considers as foreground and second color as background color, even if you put style in middle it will behave same

To print text with styles

use pealn::{pealn};

pealn!("[bold,underline](Hello) [italic](World)!");

To print text with color and styles

use pealn::{pealn};
//here order of colors and styles does not matter, 
//first color will be used as foreground and second as background
pealn!("[red,green,bold,underline](Hello) [yellow,italic,white](World)!");

see docs for detailed information

🤝 Contributing

We welcome contributions!
Please see CONTRIBUTION.md for guidelines.

Pealn makes your CLI apps more colorful and expressive!

About

Pealn is a rust library , its a declaretive and simple way to print colored and styled text on console

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages