1use inksac::prelude::*;
4
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let header_style = Style::builder()
7 .foreground(Color::White)
8 .background(Color::Blue)
9 .bold()
10 .build();
11
12 let alt_row_style = Style::builder()
13 .background(Color::new_rgb(240, 240, 240)?)
14 .build();
15
16 println!(
18 "{}",
19 format!("{:<20} {:<15} {:<10}", "Name", "Role", "Status").style(header_style)
20 );
21
22 let data = [
24 ("Alice Smith", "Developer", "Active"),
25 ("Bob Johnson", "Designer", "Away"),
26 ("Carol White", "Manager", "Busy"),
27 ];
28
29 for (i, (name, role, status)) in data.iter().enumerate() {
30 let row = format!("{:<20} {:<15} {:<10}", name, role, status);
31 if i % 2 == 1 {
32 println!("{}", row.style(alt_row_style));
33 } else {
34 println!("{}", row);
35 }
36 }
37
38 Ok(())
39}