spruce/block
Block styling for multiline terminal text.
Types
Values
pub fn align(
block: Block,
horizontal horizontal: layout.Pos,
vertical vertical: layout.Pos,
) -> Block
Align content horizontally within width and vertically within height.
pub fn background(block: Block, color: style.Color) -> Block
Set the background color applied to content lines.
pub fn border(block: Block, border: box.Border) -> Block
Draw a border around the padded block.
pub fn border_colors(
block: Block,
top top: style.Color,
right right: style.Color,
bottom bottom: style.Color,
left left: style.Color,
) -> Block
Set top, right, bottom, and left border colors independently.
pub fn border_sides(
block: Block,
top top: Bool,
right right: Bool,
bottom bottom: Bool,
left left: Bool,
) -> Block
Set top, right, bottom, and left border visibility independently.
pub fn foreground(block: Block, color: style.Color) -> Block
Set the foreground color applied to content lines.
pub fn height(block: Block, height: Int) -> Block
Constrain content to a line count. Short content is padded with blank lines using vertical alignment; tall content is truncated from the bottom after wrapping.
pub fn margin(
block: Block,
top top: Int,
right right: Int,
bottom bottom: Int,
left left: Int,
) -> Block
Set outer margin as top, right, bottom, left cell counts.
pub fn padding(
block: Block,
top top: Int,
right right: Int,
bottom bottom: Int,
left left: Int,
) -> Block
Set inner padding as top, right, bottom, left cell counts.
pub fn render(
sp: spruce.Spruce,
content: String,
block: Block,
) -> String
Render content as one block using the given options.