generated from PlexSheep/baserepo
idk why this isn't in master yet #94
|
@ -42,10 +42,10 @@ pub fn blockprint(content: impl ToString, color: Color) {
|
||||||
pub fn blockfmt(content: impl ToString, color: Color) -> String {
|
pub fn blockfmt(content: impl ToString, color: Color) -> String {
|
||||||
blockfmt_advanced(
|
blockfmt_advanced(
|
||||||
content,
|
content,
|
||||||
color,
|
Some(color),
|
||||||
presets::UTF8_BORDERS_ONLY,
|
presets::UTF8_BORDERS_ONLY,
|
||||||
ContentArrangement::DynamicFullWidth,
|
ContentArrangement::DynamicFullWidth,
|
||||||
CellAlignment::Center
|
CellAlignment::Center,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ pub fn blockfmt(content: impl ToString, color: Color) -> String {
|
||||||
/// "{}",
|
/// "{}",
|
||||||
/// blockfmt_advanced(
|
/// blockfmt_advanced(
|
||||||
/// "Hello world!".to_string(),
|
/// "Hello world!".to_string(),
|
||||||
/// Color::Blue,
|
/// Some(Color::Blue),
|
||||||
/// presets::UTF8_FULL,
|
/// presets::UTF8_FULL,
|
||||||
/// ContentArrangement::DynamicFullWidth,
|
/// ContentArrangement::DynamicFullWidth,
|
||||||
/// CellAlignment::Center
|
/// CellAlignment::Center
|
||||||
|
@ -86,20 +86,20 @@ pub fn blockfmt(content: impl ToString, color: Color) -> String {
|
||||||
///
|
///
|
||||||
pub fn blockfmt_advanced(
|
pub fn blockfmt_advanced(
|
||||||
content: impl ToString,
|
content: impl ToString,
|
||||||
color: Color,
|
color: Option<Color>,
|
||||||
preset: &str,
|
preset: &str,
|
||||||
arrangement: ContentArrangement,
|
arrangement: ContentArrangement,
|
||||||
alignment: CellAlignment
|
alignment: CellAlignment,
|
||||||
) -> String {
|
) -> String {
|
||||||
let mut table = Table::new();
|
let mut table = Table::new();
|
||||||
table
|
table
|
||||||
.load_preset(preset)
|
.load_preset(preset)
|
||||||
.set_content_arrangement(arrangement)
|
.set_content_arrangement(arrangement)
|
||||||
.add_row(vec![content.to_string()]);
|
.add_row(vec![content.to_string()]);
|
||||||
table
|
table.column_mut(0).unwrap().set_cell_alignment(alignment);
|
||||||
.column_mut(0)
|
|
||||||
.unwrap()
|
|
||||||
.set_cell_alignment(alignment);
|
|
||||||
|
|
||||||
format!("{}", style(table).fg(color))
|
match color {
|
||||||
|
Some(c) => format!("{}", style(table).fg(c)),
|
||||||
|
None => table.to_string(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue