Custom Renderers
We're pleased to introduce custom renders for Lip Gloss! Custom renderers allow you to render to a specific outputs, which is particularly important when you want to detect the color profile and dark background status for multiple different outputs at runtime, such as in a server-client situation.
Here's what it looks like:
func myLittleHandler(sess ssh.Session) {
// Create a renderer for the client.
renderer := lipgloss.NewRenderer(sess)
// Create a new style on the renderer.
style := renderer.NewStyle().Background(lipgloss.AdaptiveColor{Light: "63", Dark: "228"})
// Render. The color profile and dark background state will be correctly detected.
io.WriteString(sess, style.Render("Heyyyyyyy"))
}
For a full example on using a custom renderer over SSH with Wish see the SSH example.
New API Stuff
type Renderer struct
NewRenderer(io.Writer)
DefaultRenderer()
SetDefaultRenderer(*lipgloss.Renderer)
style.Renderer(*lipgloss.Renderer) Style
What's Changed
New
- lipgloss renderer by @aymanbagabas in #140 and #174
- add BlockBorder, OuterHalfBlockBorder, and InnerHalfBlockBorder border styles by @VictorBersy in #120
Fixed
- RGBA implementations for non-hex color values by @muesli in #126
- unify get border size function names by @nerg4l in #148
- reduce dependencies by @caarlos0 in #146
- don't concurrently change output profiles by @muesli in #172
New Contributors
- @dependabot made their first contribution in #133
- @winder made their first contribution in #147
- @VictorBersy made their first contribution in #120
- @nervo made their first contribution in #156
- @caarlos0 made their first contribution in #146
- @Isti115 made their first contribution in #170
- @nerg4l made their first contribution in #148
Full Changelog: v0.6.0...v0.7.0