pub struct Theme { /* private fields */ }
std
only.Expand description
A raw style data, which can be produced safely from Style
.
It can be useful in order to not have a generics and be able to use it as a variable more conveniently.
Implementations§
source§impl Theme
impl Theme
sourcepub const fn from_style<T, B, L, R, H, V, const HS: usize, const VS: usize>(
style: Style<T, B, L, R, H, V, HS, VS>
) -> Self
pub const fn from_style<T, B, L, R, H, V, const HS: usize, const VS: usize>( style: Style<T, B, L, R, H, V, HS, VS> ) -> Self
Build a theme out of a style builder.
source§impl Theme
impl Theme
sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new empty style.
It’s quite an analog of Style::empty
source§impl Theme
impl Theme
sourcepub fn set_border_top(&mut self, c: char)
pub fn set_border_top(&mut self, c: char)
Set a border character top .
sourcepub fn set_border_bottom(&mut self, c: char)
pub fn set_border_bottom(&mut self, c: char)
Set a border character bottom .
sourcepub fn set_border_left(&mut self, c: char)
pub fn set_border_left(&mut self, c: char)
Set a border character left .
sourcepub fn set_border_right(&mut self, c: char)
pub fn set_border_right(&mut self, c: char)
Set a border character right .
sourcepub fn set_border_corner_top_left(&mut self, c: char)
pub fn set_border_corner_top_left(&mut self, c: char)
Set a border character top left corner .
sourcepub fn set_border_corner_top_right(&mut self, c: char)
pub fn set_border_corner_top_right(&mut self, c: char)
Set a border character top right corner .
sourcepub fn set_border_corner_bottom_left(&mut self, c: char)
pub fn set_border_corner_bottom_left(&mut self, c: char)
Set a border character bottom left corner .
sourcepub fn set_border_corner_bottom_right(&mut self, c: char)
pub fn set_border_corner_bottom_right(&mut self, c: char)
Set a border character bottom right corner .
sourcepub fn set_border_intersection_top(&mut self, c: char)
pub fn set_border_intersection_top(&mut self, c: char)
Set a border character top intersection with a vertical line .
sourcepub fn set_border_intersection_bottom(&mut self, c: char)
pub fn set_border_intersection_bottom(&mut self, c: char)
Set a border character bottom intersection with a vertical line .
sourcepub fn set_border_intersection_left(&mut self, c: char)
pub fn set_border_intersection_left(&mut self, c: char)
Set a border character left intersection with a horizontal line .
sourcepub fn set_border_intersection_right(&mut self, c: char)
pub fn set_border_intersection_right(&mut self, c: char)
Set a border character right intersection with a horizontal line .
sourcepub fn set_border_intersection(&mut self, c: char)
pub fn set_border_intersection(&mut self, c: char)
Set a border character intersection of horizontal and vertical line .
sourcepub fn set_border_horizontal(&mut self, c: char)
pub fn set_border_horizontal(&mut self, c: char)
Set a border character horizontal .
sourcepub fn set_border_vertical(&mut self, c: char)
pub fn set_border_vertical(&mut self, c: char)
Set a border character vertical .
source§impl Theme
impl Theme
sourcepub const fn get_border_top(&self) -> Option<char>
pub const fn get_border_top(&self) -> Option<char>
Get a border character top .
sourcepub const fn get_border_bottom(&self) -> Option<char>
pub const fn get_border_bottom(&self) -> Option<char>
Get a border character bottom .
sourcepub const fn get_border_left(&self) -> Option<char>
pub const fn get_border_left(&self) -> Option<char>
Get a border character left .
sourcepub const fn get_border_right(&self) -> Option<char>
pub const fn get_border_right(&self) -> Option<char>
Get a border character right .
sourcepub const fn get_border_corner_top_left(&self) -> Option<char>
pub const fn get_border_corner_top_left(&self) -> Option<char>
Get a border character top left corner .
sourcepub const fn get_border_corner_top_right(&self) -> Option<char>
pub const fn get_border_corner_top_right(&self) -> Option<char>
Get a border character top right corner .
sourcepub const fn get_border_corner_bottom_left(&self) -> Option<char>
pub const fn get_border_corner_bottom_left(&self) -> Option<char>
Get a border character bottom left corner .
sourcepub const fn get_border_corner_bottom_right(&self) -> Option<char>
pub const fn get_border_corner_bottom_right(&self) -> Option<char>
Get a border character bottom right corner .
sourcepub const fn get_border_intersection_top(&self) -> Option<char>
pub const fn get_border_intersection_top(&self) -> Option<char>
Get a border character top intersection with a vertical line .
sourcepub const fn get_border_intersection_bottom(&self) -> Option<char>
pub const fn get_border_intersection_bottom(&self) -> Option<char>
Get a border character bottom intersection with a vertical line .
sourcepub const fn get_border_intersection_left(&self) -> Option<char>
pub const fn get_border_intersection_left(&self) -> Option<char>
Get a border character left intersection with a horizontal line .
sourcepub const fn get_border_intersection_right(&self) -> Option<char>
pub const fn get_border_intersection_right(&self) -> Option<char>
Get a border character right intersection with a horizontal line .
sourcepub const fn get_border_intersection(&self) -> Option<char>
pub const fn get_border_intersection(&self) -> Option<char>
Get a border character intersection of horizontal and vertical line .
sourcepub const fn get_border_horizontal(&self) -> Option<char>
pub const fn get_border_horizontal(&self) -> Option<char>
Get a border character horizontal .
sourcepub const fn get_border_vertical(&self) -> Option<char>
pub const fn get_border_vertical(&self) -> Option<char>
Get a border character vertical .
source§impl Theme
impl Theme
sourcepub fn remove_border_top(&mut self)
pub fn remove_border_top(&mut self)
Remove a border character top .
sourcepub fn remove_border_bottom(&mut self)
pub fn remove_border_bottom(&mut self)
Remove a border character bottom .
sourcepub fn remove_border_left(&mut self)
pub fn remove_border_left(&mut self)
Remove a border character left .
sourcepub fn remove_border_right(&mut self)
pub fn remove_border_right(&mut self)
Remove a border character right .
sourcepub fn remove_border_corner_top_left(&mut self)
pub fn remove_border_corner_top_left(&mut self)
Remove a border character top left corner .
sourcepub fn remove_border_corner_top_right(&mut self)
pub fn remove_border_corner_top_right(&mut self)
Remove a border character top right corner .
sourcepub fn remove_border_corner_bottom_left(&mut self)
pub fn remove_border_corner_bottom_left(&mut self)
Remove a border character bottom left corner .
sourcepub fn remove_border_corner_bottom_right(&mut self)
pub fn remove_border_corner_bottom_right(&mut self)
Remove a border character bottom right corner .
sourcepub fn remove_border_intersection_top(&mut self)
pub fn remove_border_intersection_top(&mut self)
Remove a border character top intersection with a vertical line .
sourcepub fn remove_border_intersection_bottom(&mut self)
pub fn remove_border_intersection_bottom(&mut self)
Remove a border character bottom intersection with a vertical line .
sourcepub fn remove_border_intersection_left(&mut self)
pub fn remove_border_intersection_left(&mut self)
Remove a border character left intersection with a horizontal line .
sourcepub fn remove_border_intersection_right(&mut self)
pub fn remove_border_intersection_right(&mut self)
Remove a border character right intersection with a horizontal line .
sourcepub fn remove_border_intersection(&mut self)
pub fn remove_border_intersection(&mut self)
Remove a border character intersection of horizontal and vertical line .
sourcepub fn remove_border_horizontal(&mut self)
pub fn remove_border_horizontal(&mut self)
Remove a border character horizontal .
sourcepub fn remove_border_vertical(&mut self)
pub fn remove_border_vertical(&mut self)
Remove a border character vertical .
source§impl Theme
impl Theme
sourcepub fn set_border_color_top(&mut self, color: Color)
pub fn set_border_color_top(&mut self, color: Color)
Set a border color top .
sourcepub fn set_border_color_bottom(&mut self, color: Color)
pub fn set_border_color_bottom(&mut self, color: Color)
Set a border color bottom .
sourcepub fn set_border_color_left(&mut self, color: Color)
pub fn set_border_color_left(&mut self, color: Color)
Set a border color left .
sourcepub fn set_border_color_right(&mut self, color: Color)
pub fn set_border_color_right(&mut self, color: Color)
Set a border color right .
sourcepub fn set_border_color_corner_top_left(&mut self, color: Color)
pub fn set_border_color_corner_top_left(&mut self, color: Color)
Set a border color top left corner .
sourcepub fn set_border_color_corner_top_right(&mut self, color: Color)
pub fn set_border_color_corner_top_right(&mut self, color: Color)
Set a border color top right corner .
sourcepub fn set_border_color_corner_bottom_left(&mut self, color: Color)
pub fn set_border_color_corner_bottom_left(&mut self, color: Color)
Set a border color bottom left corner .
sourcepub fn set_border_color_corner_bottom_right(&mut self, color: Color)
pub fn set_border_color_corner_bottom_right(&mut self, color: Color)
Set a border color bottom right corner .
sourcepub fn set_border_color_intersection_top(&mut self, color: Color)
pub fn set_border_color_intersection_top(&mut self, color: Color)
Set a border color top intersection with a vertical line .
sourcepub fn set_border_color_intersection_bottom(&mut self, color: Color)
pub fn set_border_color_intersection_bottom(&mut self, color: Color)
Set a border color bottom intersection with a vertical line .
sourcepub fn set_border_color_intersection_left(&mut self, color: Color)
pub fn set_border_color_intersection_left(&mut self, color: Color)
Set a border color left intersection with a horizontal line .
sourcepub fn set_border_color_intersection_right(&mut self, color: Color)
pub fn set_border_color_intersection_right(&mut self, color: Color)
Set a border color right intersection with a horizontal line .
sourcepub fn set_border_color_intersection(&mut self, color: Color)
pub fn set_border_color_intersection(&mut self, color: Color)
Set a border color intersection of horizontal and vertical line .
sourcepub fn set_border_color_horizontal(&mut self, color: Color)
pub fn set_border_color_horizontal(&mut self, color: Color)
Set a border color horizontal .
sourcepub fn set_border_color_vertical(&mut self, color: Color)
pub fn set_border_color_vertical(&mut self, color: Color)
Set a border color vertical .
source§impl Theme
impl Theme
sourcepub fn remove_border_color_top(&mut self)
pub fn remove_border_color_top(&mut self)
Remove a border color top .
sourcepub fn remove_border_color_bottom(&mut self)
pub fn remove_border_color_bottom(&mut self)
Remove a border color bottom .
sourcepub fn remove_border_color_left(&mut self)
pub fn remove_border_color_left(&mut self)
Remove a border color left .
sourcepub fn remove_border_color_right(&mut self)
pub fn remove_border_color_right(&mut self)
Remove a border color right .
sourcepub fn remove_border_color_corner_top_left(&mut self)
pub fn remove_border_color_corner_top_left(&mut self)
Remove a border color top left corner .
sourcepub fn remove_border_color_corner_top_right(&mut self)
pub fn remove_border_color_corner_top_right(&mut self)
Remove a border color top right corner .
sourcepub fn remove_border_color_corner_bottom_left(&mut self)
pub fn remove_border_color_corner_bottom_left(&mut self)
Remove a border color bottom left corner .
sourcepub fn remove_border_color_corner_bottom_right(&mut self)
pub fn remove_border_color_corner_bottom_right(&mut self)
Remove a border color bottom right corner .
sourcepub fn remove_border_color_intersection_top(&mut self)
pub fn remove_border_color_intersection_top(&mut self)
Remove a border color top intersection with a vertical line .
sourcepub fn remove_border_color_intersection_bottom(&mut self)
pub fn remove_border_color_intersection_bottom(&mut self)
Remove a border color bottom intersection with a vertical line .
sourcepub fn remove_border_color_intersection_left(&mut self)
pub fn remove_border_color_intersection_left(&mut self)
Remove a border color left intersection with a horizontal line .
sourcepub fn remove_border_color_intersection_right(&mut self)
pub fn remove_border_color_intersection_right(&mut self)
Remove a border color right intersection with a horizontal line .
sourcepub fn remove_border_color_intersection(&mut self)
pub fn remove_border_color_intersection(&mut self)
Remove a border color intersection of horizontal and vertical line .
sourcepub fn remove_border_color_horizontal(&mut self)
pub fn remove_border_color_horizontal(&mut self)
Remove a border color horizontal .
sourcepub fn remove_border_color_vertical(&mut self)
pub fn remove_border_color_vertical(&mut self)
Remove a border color vertical .
source§impl Theme
impl Theme
sourcepub fn get_border_color_top(&self) -> Option<&Color>
pub fn get_border_color_top(&self) -> Option<&Color>
Get a border color top .
sourcepub fn get_border_color_bottom(&self) -> Option<&Color>
pub fn get_border_color_bottom(&self) -> Option<&Color>
Get a border color bottom .
sourcepub fn get_border_color_left(&self) -> Option<&Color>
pub fn get_border_color_left(&self) -> Option<&Color>
Get a border color left .
sourcepub fn get_border_color_right(&self) -> Option<&Color>
pub fn get_border_color_right(&self) -> Option<&Color>
Get a border color right .
sourcepub fn get_border_color_corner_top_left(&self) -> Option<&Color>
pub fn get_border_color_corner_top_left(&self) -> Option<&Color>
Get a border color top left corner .
sourcepub fn get_border_color_corner_top_right(&self) -> Option<&Color>
pub fn get_border_color_corner_top_right(&self) -> Option<&Color>
Get a border color top right corner .
sourcepub fn get_border_color_corner_bottom_left(&self) -> Option<&Color>
pub fn get_border_color_corner_bottom_left(&self) -> Option<&Color>
Get a border color bottom left corner .
sourcepub fn get_border_color_corner_bottom_right(&self) -> Option<&Color>
pub fn get_border_color_corner_bottom_right(&self) -> Option<&Color>
Get a border color bottom right corner .
sourcepub fn get_border_color_intersection_top(&self) -> Option<&Color>
pub fn get_border_color_intersection_top(&self) -> Option<&Color>
Get a border color top intersection with a vertical line .
sourcepub fn get_border_color_intersection_bottom(&self) -> Option<&Color>
pub fn get_border_color_intersection_bottom(&self) -> Option<&Color>
Get a border color bottom intersection with a vertical line .
sourcepub fn get_border_color_intersection_left(&self) -> Option<&Color>
pub fn get_border_color_intersection_left(&self) -> Option<&Color>
Get a border color left intersection with a horizontal line .
sourcepub fn get_border_color_intersection_right(&self) -> Option<&Color>
pub fn get_border_color_intersection_right(&self) -> Option<&Color>
Get a border color right intersection with a horizontal line .
sourcepub fn get_border_color_intersection(&self) -> Option<&Color>
pub fn get_border_color_intersection(&self) -> Option<&Color>
Get a border color intersection of horizontal and vertical line .
sourcepub fn get_border_color_horizontal(&self) -> Option<&Color>
pub fn get_border_color_horizontal(&self) -> Option<&Color>
Get a border color horizontal .
sourcepub fn get_border_color_vertical(&self) -> Option<&Color>
pub fn get_border_color_vertical(&self) -> Option<&Color>
Get a border color vertical .
source§impl Theme
impl Theme
sourcepub fn set_border_frame(&mut self, frame: Border<char>)
pub fn set_border_frame(&mut self, frame: Border<char>)
Returns an outer border of the style.
sourcepub fn set_border_color_frame(&mut self, frame: Border<Color>)
pub fn set_border_color_frame(&mut self, frame: Border<Color>)
Returns an outer border of the style.
sourcepub fn set_border(&mut self, borders: Borders<char>)
pub fn set_border(&mut self, borders: Borders<char>)
Set borders structure.
sourcepub fn set_border_color(&mut self, borders: Borders<Color>)
pub fn set_border_color(&mut self, borders: Borders<Color>)
Set borders structure.
sourcepub const fn get_border_frame(&self) -> Border<char>
pub const fn get_border_frame(&self) -> Border<char>
Set an outer border.
sourcepub const fn get_border_color_frame(&self) -> Border<&Color>
pub const fn get_border_color_frame(&self) -> Border<&Color>
Set an outer border.
source§impl Theme
impl Theme
sourcepub fn set_lines_horizontal(
&mut self,
lines: HashMap<usize, HorizontalLine<char>>
)
pub fn set_lines_horizontal( &mut self, lines: HashMap<usize, HorizontalLine<char>> )
Set horizontal border lines.
Example
use std::collections::HashMap;
use tabled::{Table, settings::style::{Style, HorizontalLine}, settings::themes::Theme};
let mut style = Theme::from(Style::re_structured_text());
let mut lines = HashMap::new();
lines.insert(1, HorizontalLine::inherit(Style::extended()).into());
style.set_lines_horizontal(lines);
let data = (0..3).map(|i| ("Hello", i));
let table = Table::new(data).with(style).to_string();
assert_eq!(
table,
concat!(
" ======= ===== \n",
" &str i32 \n",
"╠═══════╬═════╣\n",
" Hello 0 \n",
" Hello 1 \n",
" Hello 2 \n",
" ======= ===== ",
),
)
sourcepub fn set_lines_vertical(&mut self, lines: HashMap<usize, VerticalLine<char>>)
pub fn set_lines_vertical(&mut self, lines: HashMap<usize, VerticalLine<char>>)
Set vertical border lines.
Example
use std::collections::HashMap;
use tabled::{
Table,
settings::style::{Style, HorizontalLine},
settings::themes::Theme,
};
let mut style = Theme::from_style(Style::re_structured_text());
let mut lines = HashMap::new();
lines.insert(1, HorizontalLine::inherit(Style::extended()).into());
style.set_lines_vertical(lines);
let data = (0..3).map(|i| ("Hello", i));
let table = Table::new(data).with(style).to_string();
assert_eq!(
table,
concat!(
"=======╠=====\n",
" &str ═ i32 \n",
"======= =====\n",
" Hello ═ 0 \n",
" Hello ═ 1 \n",
" Hello ═ 2 \n",
"=======╣=====",
),
)
sourcepub fn insert_line_vertical(
&mut self,
line: usize,
vertical: VerticalLine<char>
)
pub fn insert_line_vertical( &mut self, line: usize, vertical: VerticalLine<char> )
Insert a vertical line into specific column location.
sourcepub fn insert_line_horizontal(
&mut self,
line: usize,
horizontal: HorizontalLine<char>
)
pub fn insert_line_horizontal( &mut self, line: usize, horizontal: HorizontalLine<char> )
Insert a horizontal line to a specific row location.
sourcepub fn get_line_vertical(&self, column: usize) -> Option<VerticalLine<char>>
pub fn get_line_vertical(&self, column: usize) -> Option<VerticalLine<char>>
Get a vertical line at the row if any set.
sourcepub fn get_line_horizontal(&self, row: usize) -> Option<HorizontalLine<char>>
pub fn get_line_horizontal(&self, row: usize) -> Option<HorizontalLine<char>>
Get a horizontal line at the row if any set.
source§impl Theme
impl Theme
sourcepub fn reverse_rows(&mut self, reverse: bool)
pub fn reverse_rows(&mut self, reverse: bool)
Reverse rows.
sourcepub fn reverse_columns(&mut self, reverse: bool)
pub fn reverse_columns(&mut self, reverse: bool)
Reverse columns.
Set a footer.
Copy columns names to an apposite side of a table.
sourcepub fn align_columns(&mut self, position: Alignment)
pub fn align_columns(&mut self, position: Alignment)
Set column alignment
Trait Implementations§
source§impl From<ColoredConfig> for Theme
impl From<ColoredConfig> for Theme
source§fn from(cfg: ColoredConfig) -> Self
fn from(cfg: ColoredConfig) -> Self
source§impl<T, B, L, R, H, V, const HSIZE: usize, const VSIZE: usize> From<Style<T, B, L, R, H, V, HSIZE, VSIZE>> for Theme
impl<T, B, L, R, H, V, const HSIZE: usize, const VSIZE: usize> From<Style<T, B, L, R, H, V, HSIZE, VSIZE>> for Theme
source§impl PartialEq for Theme
impl PartialEq for Theme
source§impl<R, D> TableOption<R, ColoredConfig, D> for Theme
impl<R, D> TableOption<R, ColoredConfig, D> for Theme
source§fn change(self, records: &mut R, cfg: &mut ColoredConfig, _: &mut D)
fn change(self, records: &mut R, cfg: &mut ColoredConfig, _: &mut D)
source§fn hint_change(&self) -> Option<Entity>
fn hint_change(&self) -> Option<Entity>
TableOption
is going to change table layout. Read moresource§impl<R, D> TableOption<R, CompactConfig, D> for Theme
impl<R, D> TableOption<R, CompactConfig, D> for Theme
source§fn change(self, _: &mut R, cfg: &mut CompactConfig, _: &mut D)
fn change(self, _: &mut R, cfg: &mut CompactConfig, _: &mut D)
source§fn hint_change(&self) -> Option<Entity>
fn hint_change(&self) -> Option<Entity>
TableOption
is going to change table layout. Read moresource§impl<R, D> TableOption<R, CompactMultilineConfig, D> for Theme
impl<R, D> TableOption<R, CompactMultilineConfig, D> for Theme
source§fn change(self, _: &mut R, cfg: &mut CompactMultilineConfig, _: &mut D)
fn change(self, _: &mut R, cfg: &mut CompactMultilineConfig, _: &mut D)
source§fn hint_change(&self) -> Option<Entity>
fn hint_change(&self) -> Option<Entity>
TableOption
is going to change table layout. Read more