Skip to content

[go-fan] Go Module Review: charm.land/lipgloss/v2Β #38813

@github-actions

Description

@github-actions

🐹 Go Fan Report: Lipgloss v2

The daily round-robin (sorted by upstream pushed_at, most-recent-first) surfaced charm.land/lipgloss/v2 β€” it was pushed today (2026-06-12T04:41:18Z) and had not been reviewed in the last 7 days. Great pick: lipgloss is the styling backbone for all of gh-aw's terminal output. πŸ‘„

Module Overview

Lipgloss is Charm's declarative, CSS-like library for styled terminal layouts: composable Style values (colors, borders, padding, margins, alignment) plus the higher-level table, tree, and list subpackages. The vanity path charm.land/lipgloss/v2 resolves to github.com/charmbracelet/lipgloss (11.4k⭐).

Current Usage in gh-aw

  • Files: 8 non-test source files
  • Version: v2.0.3 β€” the latest stable release βœ…
  • Key APIs Used: NewStyle (56x), Color (38x), Style (10x), border constructors (Rounded/Normal/Thick/Double/Hidden), HasDarkBackground, LightDark, Fprintf, JoinVertical, plus the table and tree subpackages.
Where lipgloss is used
File Role
pkg/styles/theme.go Central palette + pre-built Style vars (the hub)
pkg/styles/huh_theme.go Maps palette onto a huh.ThemeFunc via LightDark
pkg/console/console.go Error/box/table rendering (uses lipgloss/v2/table)
pkg/console/banner.go ASCII banner styling
pkg/cli/status_command.go Dependency tree (uses lipgloss/v2/tree)
pkg/cli/mcp_inspect.go MCP server tree (uses lipgloss/v2/tree)
pkg/cli/compile_schedule_calendar.go Schedule heatmap intensity styles
pkg/logger/logger.go Per-label color palette + lipgloss.Fprintf

Research Findings

The usage here is mature and genuinely idiomatic for lipgloss v2 β€” this is one of the better-integrated dependencies in the tree:

  • Adaptive colors via compat.AdaptiveColor{Light, Dark}, resolved at render time (not creation), so package-level var styles work correctly.
  • compat configured once in styles.init(), guarded by shouldConfigureLipglossCompat to skip terminal probing on redirected/pipe handles on Windows.
  • Consistent TTY gating (applyStyle/isTTY) so non-terminal output stays plain.
  • Already adopting the structured table and tree subpackages instead of hand-rolling layout.

Recent Updates

Nothing actionable since v2.0.3 (2026-04-13). Commits on main are only golang.org/x/sys dependency bumps and doc fixes β€” no new public API. Notably, the Avoid background color query hang fix (#636) and the x/ansi width-calculation fix are already included in v2.0.3, so the version in go.mod is fully current.

Best Practices

Maintainers recommend adaptive colors, render-time resolution, and the structured subpackages β€” all of which gh-aw already does.

Improvement Opportunities

πŸƒ Quick Wins

✨ Feature Opportunities

  • Adopt lipgloss/v2/list for console.FormatListItem, which currently hand-builds bullets via string concatenation (" β€’ " + item). The list subpackage (sibling of the already-used table/tree) offers consistent enumerators, indentation, and nesting β€” completing the structured-layout trio.

πŸ“ Best Practice Alignment

  • Stay pinned to the tagged v2.0.3 rather than chasing main; there are no upstream features to gain, only routine dep bumps.

πŸ”§ General Improvements

  • logger.go and compile_schedule_calendar.go build fresh NewStyle().Foreground(...) styles inline. Reusing named styles from pkg/styles would give a single source of truth for the palette (a consistency/maintainability nicety, not a perf issue β€” lipgloss styles are cheap value types).

Recommendations

  1. (Optional, low effort) Migrate FormatListItem to lipgloss/v2/list for layout consistency with the existing table/tree rendering.
  2. (Optional, trivial) Add a comment in styles/theme.go noting that the Windows guard complements upstream fix [Custom Engine Test] Test Pull Request - Custom Engine Safe OutputΒ #636.
  3. (Housekeeping) Keep v2.0.3 pinned; revisit when lipgloss tags a v2.0.4+ with new features.

Next Steps

This is a well-utilized, current dependency β€” no urgent action. The list-subpackage migration is the only net-new capability available and is a nice-to-have.


Generated by Go Fan
Module summary saved to: scratchpad/mods/lipgloss.md

Generated by 🐹 Go Fan Β· 136.6 AIC Β· βŒ– 13.2 AIC Β· ⊞ 8K Β· β—·

  • expires on Jun 13, 2026, 1:18 AM UTC-08:00

Metadata

Metadata

Labels

automationcookieIssue Monster Loves Cookies!dependenciesPull requests that update a dependency filego

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions