Skip to main content

StyleFunc

Type Alias StyleFunc 

Source
pub type StyleFunc = fn(row: i32, col: usize) -> Style;
Expand description

StyleFunc is the style function that determines the style of a Cell.

It takes the row and column of the cell as an input and determines the lipgloss Style to use for that cell position.

Example:

use lipgloss::{Style, Color};
use lipgloss_table::{Table, HEADER_ROW};

let style_func = |row: i32, col: usize| {
    match row {
        HEADER_ROW => Style::new().bold(true),
        _ if row % 2 == 0 => Style::new().foreground(Color::from("#888888")),
        _ => Style::new(),
    }
};