use gilt::console::Console;
use gilt::rule::Rule;
use gilt::styled_str::Stylize;
fn main() {
let mut console = Console::builder()
.width(72)
.force_terminal(true)
.no_color(false)
.build();
console.print(&Rule::with_title("Basic Attributes"));
console.print(&"This text is bold".bold());
console.print(&"This text is italic".italic());
console.print(&"This text is underline".underline());
console.print(&"This text is strikethrough".strikethrough());
console.print(&"This text is dim".dim());
console.print(&Rule::with_title("Foreground Colors"));
console.print(&"Red text".red());
console.print(&"Green text".green());
console.print(&"Blue text".blue());
console.print(&"Cyan text".cyan());
console.print(&"Magenta text".magenta());
console.print(&"Bright yellow text".bright_yellow());
console.print(&"Bright cyan text".bright_cyan());
console.print(&Rule::with_title("Background Colors"));
console.print(&"Text on blue background".on_blue());
console.print(&"Text on red background".on_red());
console.print(&"Text on green background".on_green());
console.print(&Rule::with_title("Chaining Styles"));
console.print(&"Bold + Red + On Blue".bold().red().on_blue());
console.print(&"Italic + Bright Yellow".italic().bright_yellow());
console.print(&"Underline + Cyan + On Red".underline().cyan().on_red());
console.print(&"Dim + Green".dim().green());
console.print(&Rule::with_title("Styled Strings Printed Together"));
let greeting = "Hello, ".bold().green();
let name = "World".bold().bright_yellow();
let punctuation = "!".bold().red();
console.print(&greeting);
console.print(&name);
console.print(&punctuation);
console.print(&Rule::with_title("Arbitrary Colors via .fg() / .bg()"));
console.print(&"Custom foreground: #ff6600 (orange)".fg("#ff6600"));
console.print(&"Custom foreground: rgb(100,149,237) (cornflower)".fg("rgb(100,149,237)"));
console.print(&"Custom background: #330066 (deep purple)".bg("#330066"));
console.print(
&"Combined: bold + #00ff88 fg + #222222 bg"
.bold()
.fg("#00ff88")
.bg("#222222"),
);
console.print(&Rule::with_title("Hyperlinks"));
console.print(
&"Click me: Rust Homepage"
.bold()
.blue()
.link("https://www.rust-lang.org"),
);
console.print(
&"Gilt on GitHub"
.underline()
.cyan()
.link("https://github.com/example/gilt"),
);
console.print(&Rule::with_title("String (owned) values"));
let owned: String = format!("Dynamically built: 2 + 2 = {}", 2 + 2);
console.print(&owned.bold().bright_green());
}