Skip to content

v0.7.0

Compare
Choose a tag to compare
@aymanbagabas aymanbagabas released this 08 Mar 20:29
· 59 commits to master since this release
19ca9a3

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

Fixed

New Contributors

Full Changelog: v0.6.0...v0.7.0