charmbracelet / lipgloss

Style definitions for nice terminal layouts 👄
MIT License
8.22k stars 231 forks source link

feat: add Blend helper #325

Closed lukechampine closed 5 months ago

lukechampine commented 5 months ago

Based on https://github.com/charmbracelet/lipgloss/pull/154, this adds a simple helper for creating gradients between two colors, without changing anything about Render. I don't have strong opinions as to the API here, I'm just looking for an easy way to create nice gradients without having to import termenv separately.

maaslalani commented 5 months ago

This might belong in https://github.com/charmbracelet/x/tree/main/colors?

meowgorithm commented 5 months ago

Yeah, I think that makes sense. @lukechampine, want to open a PR over there?

I'd also suggest using go-colourful directly (termenv is just wrapping it) and blending with the HSLuv algorithm.

lukechampine commented 5 months ago

ah, thanks -- go-colorful has no dependencies, so that's perfect