pub struct Theme { /* private fields */ }
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 new() -> Self
pub const fn new() -> Self
Creates a new empty style.
It’s an analog of Style::empty
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.
Sourcepub fn set_frame_colors(&mut self, frame: Border<Color>)
pub fn set_frame_colors(&mut self, frame: Border<Color>)
Returns an outer border of the style.
Sourcepub fn set_borders(&mut self, borders: Borders<char>)
pub fn set_borders(&mut self, borders: Borders<char>)
Set borders structure.
Sourcepub fn set_colors(&mut self, borders: Borders<Color>)
pub fn set_colors(&mut self, borders: Borders<Color>)
Set borders structure.
Sourcepub const fn get_borders(&self) -> &Borders<char>
pub const fn get_borders(&self) -> &Borders<char>
Get borders structure.
Sourcepub const fn get_borders_colors(&self) -> &Borders<Color>
pub const fn get_borders_colors(&self) -> &Borders<Color>
Get borders color structure.
Sourcepub fn get_borders_mut(&mut self) -> &mut Borders<char>
pub fn get_borders_mut(&mut self) -> &mut Borders<char>
Get borders structure.
Sourcepub fn get_colors_mut(&mut self) -> &mut Borders<Color>
pub fn get_colors_mut(&mut self) -> &mut Borders<Color>
Get borders color structure.
Sourcepub fn remove_borders(&mut self)
pub fn remove_borders(&mut self)
Remove borders.
Sourcepub fn remove_colors(&mut self)
pub fn remove_colors(&mut self)
Remove colors.
Sourcepub fn remove_horizontal_lines(&mut self)
pub fn remove_horizontal_lines(&mut self)
Remove horizontal lines.
Sourcepub fn remove_vertical_lines(&mut self)
pub fn remove_vertical_lines(&mut self)
Remove vertical lines.
Sourcepub const fn get_frame_colors(&self) -> Border<&Color>
pub const fn get_frame_colors(&self) -> Border<&Color>
Set an outer border.
Sourcepub fn set_horizontal_lines(
&mut self,
lines: HashMap<usize, HorizontalLine<char>>,
)
pub fn set_horizontal_lines( &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_horizontal_lines(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_vertical_lines(&mut self, lines: HashMap<usize, VerticalLine<char>>)
pub fn set_vertical_lines(&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_vertical_lines(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_vertical_line<L>(&mut self, line: usize, vertical: L)
pub fn insert_vertical_line<L>(&mut self, line: usize, vertical: L)
Insert a vertical line into specific column location.
Sourcepub fn insert_horizontal_line<L>(&mut self, line: usize, horizontal: L)
pub fn insert_horizontal_line<L>(&mut self, line: usize, horizontal: L)
Insert a horizontal line to a specific row location.
Sourcepub fn get_vertical_line(&self, column: usize) -> Option<&VerticalLine<char>>
pub fn get_vertical_line(&self, column: usize) -> Option<&VerticalLine<char>>
Get a vertical line at the row if any set.
Sourcepub fn get_horizontal_line(&self, row: usize) -> Option<&HorizontalLine<char>>
pub fn get_horizontal_line(&self, row: usize) -> Option<&HorizontalLine<char>>
Get a horizontal line at the row if any set.
Sourcepub const fn borders_has_left(&self) -> bool
pub const fn borders_has_left(&self) -> bool
Verifies if borders has left line set on the frame.
Sourcepub const fn borders_has_right(&self) -> bool
pub const fn borders_has_right(&self) -> bool
Verifies if borders has right line set on the frame.
Sourcepub const fn borders_has_top(&self) -> bool
pub const fn borders_has_top(&self) -> bool
Verifies if borders has top line set on the frame.
Sourcepub const fn borders_has_bottom(&self) -> bool
pub const fn borders_has_bottom(&self) -> bool
Verifies if borders has bottom line set on the frame.
Sourcepub const fn borders_has_horizontal(&self) -> bool
pub const fn borders_has_horizontal(&self) -> bool
Verifies if borders has horizontal lines set.
Sourcepub const fn borders_has_vertical(&self) -> bool
pub const fn borders_has_vertical(&self) -> bool
Verifies if borders has vertical lines set.
Source§impl Theme
impl Theme
Sourcepub fn set_borders_top(&mut self, c: char)
pub fn set_borders_top(&mut self, c: char)
Set a border character top .
Sourcepub fn set_borders_bottom(&mut self, c: char)
pub fn set_borders_bottom(&mut self, c: char)
Set a border character bottom .
Sourcepub fn set_borders_left(&mut self, c: char)
pub fn set_borders_left(&mut self, c: char)
Set a border character left .
Sourcepub fn set_borders_right(&mut self, c: char)
pub fn set_borders_right(&mut self, c: char)
Set a border character right .
Sourcepub fn set_borders_corner_top_left(&mut self, c: char)
pub fn set_borders_corner_top_left(&mut self, c: char)
Set a border character top left corner .
Sourcepub fn set_borders_corner_top_right(&mut self, c: char)
pub fn set_borders_corner_top_right(&mut self, c: char)
Set a border character top right corner .
Sourcepub fn set_borders_corner_bottom_left(&mut self, c: char)
pub fn set_borders_corner_bottom_left(&mut self, c: char)
Set a border character bottom left corner .
Sourcepub fn set_borders_corner_bottom_right(&mut self, c: char)
pub fn set_borders_corner_bottom_right(&mut self, c: char)
Set a border character bottom right corner .
Sourcepub fn set_borders_intersection_top(&mut self, c: char)
pub fn set_borders_intersection_top(&mut self, c: char)
Set a border character top intersection with a vertical line .
Sourcepub fn set_borders_intersection_bottom(&mut self, c: char)
pub fn set_borders_intersection_bottom(&mut self, c: char)
Set a border character bottom intersection with a vertical line .
Sourcepub fn set_borders_intersection_left(&mut self, c: char)
pub fn set_borders_intersection_left(&mut self, c: char)
Set a border character left intersection with a horizontal line .
Sourcepub fn set_borders_intersection_right(&mut self, c: char)
pub fn set_borders_intersection_right(&mut self, c: char)
Set a border character right intersection with a horizontal line .
Sourcepub fn set_borders_intersection(&mut self, c: char)
pub fn set_borders_intersection(&mut self, c: char)
Set a border character intersection of horizontal and vertical line .
Sourcepub fn set_borders_horizontal(&mut self, c: char)
pub fn set_borders_horizontal(&mut self, c: char)
Set a border character horizontal .
Sourcepub fn set_borders_vertical(&mut self, c: char)
pub fn set_borders_vertical(&mut self, c: char)
Set a border character vertical .
Source§impl Theme
impl Theme
Sourcepub const fn get_borders_top(&self) -> Option<char>
pub const fn get_borders_top(&self) -> Option<char>
Get a border character top .
Sourcepub const fn get_borders_bottom(&self) -> Option<char>
pub const fn get_borders_bottom(&self) -> Option<char>
Get a border character bottom .
Sourcepub const fn get_borders_left(&self) -> Option<char>
pub const fn get_borders_left(&self) -> Option<char>
Get a border character left .
Sourcepub const fn get_borders_right(&self) -> Option<char>
pub const fn get_borders_right(&self) -> Option<char>
Get a border character right .
Sourcepub const fn get_borders_corner_top_left(&self) -> Option<char>
pub const fn get_borders_corner_top_left(&self) -> Option<char>
Get a border character top left corner .
Sourcepub const fn get_borders_corner_top_right(&self) -> Option<char>
pub const fn get_borders_corner_top_right(&self) -> Option<char>
Get a border character top right corner .
Sourcepub const fn get_borders_corner_bottom_left(&self) -> Option<char>
pub const fn get_borders_corner_bottom_left(&self) -> Option<char>
Get a border character bottom left corner .
Sourcepub const fn get_borders_corner_bottom_right(&self) -> Option<char>
pub const fn get_borders_corner_bottom_right(&self) -> Option<char>
Get a border character bottom right corner .
Sourcepub const fn get_borders_intersection_top(&self) -> Option<char>
pub const fn get_borders_intersection_top(&self) -> Option<char>
Get a border character top intersection with a vertical line .
Sourcepub const fn get_borders_intersection_bottom(&self) -> Option<char>
pub const fn get_borders_intersection_bottom(&self) -> Option<char>
Get a border character bottom intersection with a vertical line .
Sourcepub const fn get_borders_intersection_left(&self) -> Option<char>
pub const fn get_borders_intersection_left(&self) -> Option<char>
Get a border character left intersection with a horizontal line .
Sourcepub const fn get_borders_intersection_right(&self) -> Option<char>
pub const fn get_borders_intersection_right(&self) -> Option<char>
Get a border character right intersection with a horizontal line .
Sourcepub const fn get_borders_intersection(&self) -> Option<char>
pub const fn get_borders_intersection(&self) -> Option<char>
Get a border character intersection of horizontal and vertical line .
Sourcepub const fn get_borders_horizontal(&self) -> Option<char>
pub const fn get_borders_horizontal(&self) -> Option<char>
Get a border character horizontal .
Sourcepub const fn get_borders_vertical(&self) -> Option<char>
pub const fn get_borders_vertical(&self) -> Option<char>
Get a border character vertical .
Source§impl Theme
impl Theme
Sourcepub fn remove_borders_top(&mut self)
pub fn remove_borders_top(&mut self)
Remove a border character top .
Sourcepub fn remove_borders_bottom(&mut self)
pub fn remove_borders_bottom(&mut self)
Remove a border character bottom .
Sourcepub fn remove_borders_left(&mut self)
pub fn remove_borders_left(&mut self)
Remove a border character left .
Sourcepub fn remove_borders_right(&mut self)
pub fn remove_borders_right(&mut self)
Remove a border character right .
Sourcepub fn remove_borders_corner_top_left(&mut self)
pub fn remove_borders_corner_top_left(&mut self)
Remove a border character top left corner .
Sourcepub fn remove_borders_corner_top_right(&mut self)
pub fn remove_borders_corner_top_right(&mut self)
Remove a border character top right corner .
Sourcepub fn remove_borders_corner_bottom_left(&mut self)
pub fn remove_borders_corner_bottom_left(&mut self)
Remove a border character bottom left corner .
Sourcepub fn remove_borders_corner_bottom_right(&mut self)
pub fn remove_borders_corner_bottom_right(&mut self)
Remove a border character bottom right corner .
Sourcepub fn remove_borders_intersection_top(&mut self)
pub fn remove_borders_intersection_top(&mut self)
Remove a border character top intersection with a vertical line .
Sourcepub fn remove_borders_intersection_bottom(&mut self)
pub fn remove_borders_intersection_bottom(&mut self)
Remove a border character bottom intersection with a vertical line .
Sourcepub fn remove_borders_intersection_left(&mut self)
pub fn remove_borders_intersection_left(&mut self)
Remove a border character left intersection with a horizontal line .
Sourcepub fn remove_borders_intersection_right(&mut self)
pub fn remove_borders_intersection_right(&mut self)
Remove a border character right intersection with a horizontal line .
Sourcepub fn remove_borders_intersection(&mut self)
pub fn remove_borders_intersection(&mut self)
Remove a border character intersection of horizontal and vertical line .
Sourcepub fn remove_borders_horizontal(&mut self)
pub fn remove_borders_horizontal(&mut self)
Remove a border character horizontal .
Sourcepub fn remove_borders_vertical(&mut self)
pub fn remove_borders_vertical(&mut self)
Remove a border character vertical .
Source§impl Theme
impl Theme
Sourcepub fn set_colors_top(&mut self, color: Color)
pub fn set_colors_top(&mut self, color: Color)
Set a border color top .
Sourcepub fn set_colors_bottom(&mut self, color: Color)
pub fn set_colors_bottom(&mut self, color: Color)
Set a border color bottom .
Sourcepub fn set_colors_left(&mut self, color: Color)
pub fn set_colors_left(&mut self, color: Color)
Set a border color left .
Sourcepub fn set_colors_right(&mut self, color: Color)
pub fn set_colors_right(&mut self, color: Color)
Set a border color right .
Sourcepub fn set_colors_corner_top_left(&mut self, color: Color)
pub fn set_colors_corner_top_left(&mut self, color: Color)
Set a border color top left corner .
Sourcepub fn set_colors_corner_top_right(&mut self, color: Color)
pub fn set_colors_corner_top_right(&mut self, color: Color)
Set a border color top right corner .
Sourcepub fn set_colors_corner_bottom_left(&mut self, color: Color)
pub fn set_colors_corner_bottom_left(&mut self, color: Color)
Set a border color bottom left corner .
Sourcepub fn set_colors_corner_bottom_right(&mut self, color: Color)
pub fn set_colors_corner_bottom_right(&mut self, color: Color)
Set a border color bottom right corner .
Sourcepub fn set_colors_intersection_top(&mut self, color: Color)
pub fn set_colors_intersection_top(&mut self, color: Color)
Set a border color top intersection with a vertical line .
Sourcepub fn set_colors_intersection_bottom(&mut self, color: Color)
pub fn set_colors_intersection_bottom(&mut self, color: Color)
Set a border color bottom intersection with a vertical line .
Sourcepub fn set_colors_intersection_left(&mut self, color: Color)
pub fn set_colors_intersection_left(&mut self, color: Color)
Set a border color left intersection with a horizontal line .
Sourcepub fn set_colors_intersection_right(&mut self, color: Color)
pub fn set_colors_intersection_right(&mut self, color: Color)
Set a border color right intersection with a horizontal line .
Sourcepub fn set_colors_intersection(&mut self, color: Color)
pub fn set_colors_intersection(&mut self, color: Color)
Set a border color intersection of horizontal and vertical line .
Sourcepub fn set_colors_horizontal(&mut self, color: Color)
pub fn set_colors_horizontal(&mut self, color: Color)
Set a border color horizontal .
Sourcepub fn set_colors_vertical(&mut self, color: Color)
pub fn set_colors_vertical(&mut self, color: Color)
Set a border color vertical .
Source§impl Theme
impl Theme
Sourcepub fn remove_colors_top(&mut self)
pub fn remove_colors_top(&mut self)
Remove a border color top .
Sourcepub fn remove_colors_bottom(&mut self)
pub fn remove_colors_bottom(&mut self)
Remove a border color bottom .
Sourcepub fn remove_colors_left(&mut self)
pub fn remove_colors_left(&mut self)
Remove a border color left .
Sourcepub fn remove_colors_right(&mut self)
pub fn remove_colors_right(&mut self)
Remove a border color right .
Sourcepub fn remove_colors_corner_top_left(&mut self)
pub fn remove_colors_corner_top_left(&mut self)
Remove a border color top left corner .
Sourcepub fn remove_colors_corner_top_right(&mut self)
pub fn remove_colors_corner_top_right(&mut self)
Remove a border color top right corner .
Sourcepub fn remove_colors_corner_bottom_left(&mut self)
pub fn remove_colors_corner_bottom_left(&mut self)
Remove a border color bottom left corner .
Sourcepub fn remove_colors_corner_bottom_right(&mut self)
pub fn remove_colors_corner_bottom_right(&mut self)
Remove a border color bottom right corner .
Sourcepub fn remove_colors_intersection_top(&mut self)
pub fn remove_colors_intersection_top(&mut self)
Remove a border color top intersection with a vertical line .
Sourcepub fn remove_colors_intersection_bottom(&mut self)
pub fn remove_colors_intersection_bottom(&mut self)
Remove a border color bottom intersection with a vertical line .
Sourcepub fn remove_colors_intersection_left(&mut self)
pub fn remove_colors_intersection_left(&mut self)
Remove a border color left intersection with a horizontal line .
Sourcepub fn remove_colors_intersection_right(&mut self)
pub fn remove_colors_intersection_right(&mut self)
Remove a border color right intersection with a horizontal line .
Sourcepub fn remove_colors_intersection(&mut self)
pub fn remove_colors_intersection(&mut self)
Remove a border color intersection of horizontal and vertical line .
Sourcepub fn remove_colors_horizontal(&mut self)
pub fn remove_colors_horizontal(&mut self)
Remove a border color horizontal .
Sourcepub fn remove_colors_vertical(&mut self)
pub fn remove_colors_vertical(&mut self)
Remove a border color vertical .
Source§impl Theme
impl Theme
Sourcepub fn get_colors_top(&self) -> Option<&Color>
pub fn get_colors_top(&self) -> Option<&Color>
Get a border color top .
Sourcepub fn get_colors_bottom(&self) -> Option<&Color>
pub fn get_colors_bottom(&self) -> Option<&Color>
Get a border color bottom .
Sourcepub fn get_colors_left(&self) -> Option<&Color>
pub fn get_colors_left(&self) -> Option<&Color>
Get a border color left .
Sourcepub fn get_colors_right(&self) -> Option<&Color>
pub fn get_colors_right(&self) -> Option<&Color>
Get a border color right .
Sourcepub fn get_colors_corner_top_left(&self) -> Option<&Color>
pub fn get_colors_corner_top_left(&self) -> Option<&Color>
Get a border color top left corner .
Sourcepub fn get_colors_corner_top_right(&self) -> Option<&Color>
pub fn get_colors_corner_top_right(&self) -> Option<&Color>
Get a border color top right corner .
Sourcepub fn get_colors_corner_bottom_left(&self) -> Option<&Color>
pub fn get_colors_corner_bottom_left(&self) -> Option<&Color>
Get a border color bottom left corner .
Sourcepub fn get_colors_corner_bottom_right(&self) -> Option<&Color>
pub fn get_colors_corner_bottom_right(&self) -> Option<&Color>
Get a border color bottom right corner .
Sourcepub fn get_colors_intersection_top(&self) -> Option<&Color>
pub fn get_colors_intersection_top(&self) -> Option<&Color>
Get a border color top intersection with a vertical line .
Sourcepub fn get_colors_intersection_bottom(&self) -> Option<&Color>
pub fn get_colors_intersection_bottom(&self) -> Option<&Color>
Get a border color bottom intersection with a vertical line .
Sourcepub fn get_colors_intersection_left(&self) -> Option<&Color>
pub fn get_colors_intersection_left(&self) -> Option<&Color>
Get a border color left intersection with a horizontal line .
Sourcepub fn get_colors_intersection_right(&self) -> Option<&Color>
pub fn get_colors_intersection_right(&self) -> Option<&Color>
Get a border color right intersection with a horizontal line .
Sourcepub fn get_colors_intersection(&self) -> Option<&Color>
pub fn get_colors_intersection(&self) -> Option<&Color>
Get a border color intersection of horizontal and vertical line .
Sourcepub fn get_colors_horizontal(&self) -> Option<&Color>
pub fn get_colors_horizontal(&self) -> Option<&Color>
Get a border color horizontal .
Sourcepub fn get_colors_vertical(&self) -> Option<&Color>
pub fn get_colors_vertical(&self) -> Option<&Color>
Get a border color vertical .
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<R, D> TableOption<R, ColoredConfig, D> for Theme
impl<R, D> TableOption<R, ColoredConfig, D> for Theme
Source§fn change(self, _: &mut R, cfg: &mut ColoredConfig, _: &mut D)
fn change(self, _: &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