from_file/
from_file.rs

1use std::fs::File;
2use std::io::Read;
3use std::path::Path;
4use termio::prelude::*;
5
6fn main() {
7    // Create a new Termio instance
8    let tcss = match Termio::from_file("examples/styles.tcss") {
9        Ok(tcss) => tcss,
10        Err(e) => {
11            eprintln!("Error loading styles: {}", e);
12            return;
13        }
14    };
15
16    // Apply styles to text
17    println!("Examples of using styles from file:");
18    println!("{}", "Page Header".style("header", &tcss));
19    println!("{}", "Important Message".style("warning", &tcss));
20    println!("{}", "Information Message".style("info", &tcss));
21    println!("{}", "Successful Action".style("success", &tcss));
22    println!("{}", "Operation Error".style("error", &tcss));
23}