Skip to content

Commit

Permalink
feat: add BlockBorder, OuterHalfBlockBorder, and `InnerHalfBlockB…
Browse files Browse the repository at this point in the history
…order` border styles (#120)
  • Loading branch information
AlyxPractice committed Oct 27, 2022
1 parent c85c4f4 commit 9ee8b6e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
48 changes: 48 additions & 0 deletions borders.go
Expand Up @@ -84,6 +84,39 @@ var (
BottomRight: "╯",
}

blockBorder = Border{
Top: "█",
Bottom: "█",
Left: "█",
Right: "█",
TopLeft: "█",
TopRight: "█",
BottomLeft: "█",
BottomRight: "█",
}

outerHalfBlockBorder = Border{
Top: "▀",
Bottom: "▄",
Left: "▌",
Right: "▐",
TopLeft: "▛",
TopRight: "▜",
BottomLeft: "▙",
BottomRight: "▟",
}

innerHalfBlockBorder = Border{
Top: "▄",
Bottom: "▀",
Left: "▐",
Right: "▌",
TopLeft: "▗",
TopRight: "▖",
BottomLeft: "▝",
BottomRight: "▘",
}

thickBorder = Border{
Top: "━",
Bottom: "━",
Expand Down Expand Up @@ -129,6 +162,21 @@ func RoundedBorder() Border {
return roundedBorder
}

// BlockBorder returns a border that takes the whole block.
func BlockBorder() Border {
return blockBorder
}

// OuterHalfBlockBorder returns a half-block border that sits outside the frame.
func OuterHalfBlockBorder() Border {
return outerHalfBlockBorder
}

// InnerHalfBlockBorder returns a half-block border that sits inside the frame.
func InnerHalfBlockBorder() Border {
return innerHalfBlockBorder
}

// ThickBorder returns a border that's thicker than the one returned by
// NormalBorder.
func ThickBorder() Border {
Expand Down
5 changes: 3 additions & 2 deletions set.go
Expand Up @@ -300,8 +300,9 @@ func (s Style) Border(b Border, sides ...bool) Style {
// the border style, the border will be enabled for all sides during rendering.
//
// You can define border characters as you'd like, though several default
// styles are included: NormalBorder(), RoundedBorder(), ThickBorder(), and
// DoubleBorder().
// styles are included: NormalBorder(), RoundedBorder(), BlockBorder(),
// OuterHalfBlockBorder(), InnerHalfBlockBorder(), ThickBorder(),
// and DoubleBorder().
//
// Example:
//
Expand Down

0 comments on commit 9ee8b6e

Please sign in to comment.