New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: New Border Title API #97
base: master
Are you sure you want to change the base?
Changes from 15 commits
b1cac8a
f3ebe5c
2b9468b
2795dbc
346a978
80468e0
32c0787
3e6dff3
fec27d1
cd06217
9b317d1
80169c0
27c2a27
314a2e2
78fea2f
0c829e8
4cf8c19
9e516bc
d59ed63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,9 +92,16 @@ var ( | |
|
||
// Dialog. | ||
|
||
dialogTitleStyle = lipgloss.NewStyle(). | ||
Background(lipgloss.Color("#6124DF")). | ||
Align(lipgloss.Center). | ||
Bold(true). | ||
Italic(true) | ||
|
||
dialogBoxStyle = lipgloss.NewStyle(). | ||
Border(lipgloss.RoundedBorder()). | ||
BorderForeground(lipgloss.Color("#874BFD")). | ||
BorderTitleStyle(dialogTitleStyle). | ||
Padding(1, 0). | ||
BorderTop(true). | ||
BorderLeft(true). | ||
|
@@ -239,7 +246,7 @@ func main() { | |
|
||
dialog := lipgloss.Place(width, 9, | ||
lipgloss.Center, lipgloss.Center, | ||
dialogBoxStyle.Render(ui), | ||
dialogBoxStyle.Copy().BorderTitle(" Question ").Render(ui), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would probably use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently this does not work as I use actual text to calculate the required text width. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it might be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd additionally add logic where, if horizontal padding is unset on the style it defaults to
However if horizontal padding is set, accept it at face value. For example,
|
||
lipgloss.WithWhitespaceChars("猫咪"), | ||
lipgloss.WithWhitespaceForeground(subtle), | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is sort of a nitpick so feel free to ignore, but instead of having a wrapper around
strings.Repeat
calledrepeatStr
I would do something like this:Where
max
is:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the
max
defined here:lipgloss/style.go
Lines 460 to 465 in 0ce5550
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion... coming out with the next update :)