Skip to content

v0.6.0

Compare
Choose a tag to compare
@maaslalani maaslalani released this 06 Sep 18:36
· 193 commits to master since this release

Vertical Alignment & Per-Profile Color Settings

In this latest release of Lip Gloss, styles now support vertical alignment! Additionally, we introduced two new color types, CompleteColor and CompleteAdaptiveColor, which lets you bypass automatic color interpolation choose colors for each color profile (ANSI, ANSI256, and TrueColor).

Align content in a Style vertically at the top, center, or bottom. To get started make a style with some Height and an AlignVertical property.

lipgloss.NewStyle().Height(5).AlignVertical(lipgloss.Center).Render("Hello, Center!")

or use the Align shorthand which sets both horizontal and vertical alignments:

lipgloss.NewStyle().Height(5).Align(lipgloss.Left, lipgloss.Bottom).Render("Hello, Center!")

image

New API:

Note, there are no breaking changes since if the Align shorthand will still accept 1 argument (variadic arguments) and will set only the horizontal alignment to maintain original functionality

  • Align(p ...Position)
  • AlignVertical(p Position)
  • AlignHorizontal(p Position)
  • GetAlignVertical() Position
  • GetAlignHorizontal() Position

Complete Colors

This revision introduces two new color types CompleteColor and CompleteAdaptiveColor. Not for the faint of heart, these types are for bypassing automatic color interpolation so you can specify exact colors for all color profiles in cases where the interpolation can benefit from manual adjustment:

cc := CompleteColor{
	TrueColor: "#6B51FF",
	ANSI256: "63",
	ANSI: "5",
}

cac := CompleteAdaptiveColor{
	Light: CompleteColor{
		TrueColor: "#FF51CE",
		ANSI256: "213",
		ANSI: "5",
	},
	Dark: CompleteColor{
		TrueColor: "#6B51FF",
		ANSI256: "63",
		ANSI: "5",
	},
}

New

Fixed

  • Protect against concurrent color profile access with a sync.RWMutex by @meowgorithm in #68
  • don't overwrite background when inheriting by @76creates in #69

New Contributors

Full Changelog: v0.5.0...v0.6.0


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on Twitter, The Fediverse, or Slack.