v0.4.0 #45
meowgorithm
started this conversation in
General
v0.4.0
#45
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Quality-of-Life Updates
This release includes a menagerie of small but useful and handy improvements.
Automatic Long String Wrapping
Occasionally you’ll have a word (often a URL or a path) that runs wider than the
Width()
you set on a style:Long strings will now automatically wrap:
For details, see the corresponding PR.
Query Borders and Whitespace
A lot of times you need to measure borders and whitespace when calculating your layouts and you end up with code like this:
This update includes a multitude of methods for querying your styles so you can do away with unnecessary constants and magic numbers. For example:
The most useful of these methods are perhaps the ones that let you query margins, borders and padding all at once:
Style.GetFrameSize() (x, y int)
Style.GetVerticalFrameSize() int
Style.GetHorizontalFrameSize() int
For details see the changelog below.
Improved Automatic Color Degradation
The Mystical Hidden Border
At first glance a hidden border seems silly. Hidden borders can be useful, however, if you want to remove a border but maintain
layout positioning in, say, an interactive TUI. Also note that you can still apply a background color to a hidden border.
To make a hidden border simply call
lipgloss.HiddenBorder()
.Changelog
Changed
Width()
now wrap automaticallyNew
HiddenBorder()
, which renders a border comprised of spacesStyle.GetBorderTopSize() int
Style.GetBorderRightSize() int
Style.GetBorderBottomSize() int
Style.GetBorderLeftSize() int
Style.GetHorizontalBorderSize() int
Style.GetVerticalBorderSize() int
Style.GetMarginTop() int
Style.GetMarginRight() int
Style.GetMarginBottom() int
Style.GetMarginLeft() int
Style.GetHorizontalMargins() int
Style.GetVerticalMargins() int
Style.GetPaddingTop() int
Style.GetPaddingRight() int
Style.GetPaddingBottom() int
Style.GetPaddingLeft() int
Style.GetHorizontalPadding() int
Style.GetVerticalPadding() int
Style.GetVerticalFrameSize() int
Style.GetHorizontalFrameSize() int
Style.GetFrameSize() (x, y int)
Border.GetTopSize() int
Border.GetRightSize() int
Border.GetBottomSize() int
Border.GetLeftSize() int
Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse or right here in GitHub Discussions.
This discussion was created from the release v0.4.0.
Beta Was this translation helpful? Give feedback.
All reactions