2022-07-06 21:57:40 +02:00
|
|
|
use tabled::{style::StyleConfig, Style};
|
|
|
|
|
2022-05-16 17:35:57 +02:00
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub struct TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
pub(crate) theme: StyleConfig,
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
impl TableTheme {
|
|
|
|
pub fn basic() -> TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
Self {
|
|
|
|
theme: Style::ascii().into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn thin() -> TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
Self {
|
|
|
|
theme: Style::modern().into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn light() -> TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
Self {
|
|
|
|
theme: Style::blank().header('─').into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn compact() -> TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
Self {
|
|
|
|
theme: Style::modern()
|
|
|
|
.left_off()
|
|
|
|
.right_off()
|
|
|
|
.horizontal_off()
|
|
|
|
.into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn with_love() -> TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
Self {
|
|
|
|
theme: Style::psql()
|
|
|
|
.header('❤')
|
|
|
|
.top('❤')
|
|
|
|
.bottom('❤')
|
|
|
|
.vertical('❤')
|
|
|
|
.into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn compact_double() -> TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
Self {
|
|
|
|
theme: Style::psql()
|
|
|
|
.header('═')
|
|
|
|
.top('═')
|
|
|
|
.bottom('═')
|
|
|
|
.vertical('║')
|
|
|
|
.top_intersection('╦')
|
|
|
|
.bottom_intersection('╩')
|
|
|
|
.header_intersection('╬')
|
|
|
|
.into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn rounded() -> TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
Self {
|
|
|
|
theme: Style::rounded().into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn reinforced() -> TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
Self {
|
|
|
|
theme: Style::modern()
|
|
|
|
.top_left_corner('┏')
|
|
|
|
.top_right_corner('┓')
|
|
|
|
.bottom_left_corner('┗')
|
|
|
|
.bottom_right_corner('┛')
|
|
|
|
.horizontal_off()
|
|
|
|
.into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn heavy() -> TableTheme {
|
2022-07-06 21:57:40 +02:00
|
|
|
Self {
|
|
|
|
theme: Style::modern()
|
|
|
|
.header('━')
|
|
|
|
.top('━')
|
|
|
|
.bottom('━')
|
|
|
|
.vertical('┃')
|
|
|
|
.left('┃')
|
|
|
|
.right('┃')
|
|
|
|
.left_intersection('┣')
|
|
|
|
.right_intersection('┫')
|
|
|
|
.bottom_intersection('┻')
|
|
|
|
.top_intersection('┳')
|
|
|
|
.top_left_corner('┏')
|
|
|
|
.top_right_corner('┓')
|
|
|
|
.bottom_left_corner('┗')
|
|
|
|
.bottom_right_corner('┛')
|
|
|
|
.header_intersection('╋')
|
|
|
|
.horizontal_off()
|
|
|
|
.into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-06 21:57:40 +02:00
|
|
|
pub fn none() -> TableTheme {
|
|
|
|
Self {
|
|
|
|
theme: Style::blank().into(),
|
2022-05-16 17:35:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|