Create shared GitLab theme for Charm libraries (fang, huh, lipgloss)

Problem

Currently, we have inconsistent branding across our Charm-based TUI components:

  • Fang uses custom GitLab colors (orange #FC6D26, purple #7759C2, etc.) - established in !2408 (merged)
  • Huh uses default/Charm theme colors
  • No shared theme infrastructure between libraries

This creates a disjointed visual experience as we migrate to huh and use more Charm libraries.

Current State

Fang Color Scheme

Defined in cmd/glab/main.go:50-89:

  • GitLab Orange: #FC6D26
  • GitLab Purple: #7759C2 / #A989F5
  • GitLab Blue: #1068BF / #4285F4
  • GitLab Red: #C91C00 / #F97583

Huh Usage

internal/iostreams/iostreams.go:342-349 - No theme applied ⚠️

Proposed Solution

Create internal/theme/gitlab.go as single source of truth for GitLab brand colors.

Package Structure

package theme

import (
    "github.com/charmbracelet/fang"
    "github.com/charmbracelet/huh"
    "github.com/charmbracelet/lipgloss/v2"
)

// GitLabColors contains the GitLab product color palette
type GitLabColors struct {
    Orange lipgloss.TerminalColor
    Purple lipgloss.TerminalColor
    Blue   lipgloss.TerminalColor
    Red    lipgloss.TerminalColor
    Text   lipgloss.TerminalColor
    Subtle lipgloss.TerminalColor
}

// NewGitLabColors creates colors using lightDarkFunc for accessibility
func NewGitLabColors(lightDarkFunc lipgloss.LightDarkFunc) GitLabColors

// FangColorScheme returns fang theme with GitLab colors
func FangColorScheme(lightDarkFunc lipgloss.LightDarkFunc) fang.ColorScheme

// HuhTheme returns huh theme with GitLab colors
func HuhTheme() *huh.Theme

Usage

// main.go - simplified
func gitLabColorScheme(lightDarkFunc lipgloss.LightDarkFunc) fang.ColorScheme {
    return theme.FangColorScheme(lightDarkFunc)
}

// iostreams.go - add theme
func (s *IOStreams) Run(ctx context.Context, field huh.Field) error {
    form := huh.NewForm(huh.NewGroup(field)).
        WithInput(s.In).
        WithOutput(s.StdOut).
        WithTheme(theme.HuhTheme())  // ✅ Apply GitLab theme
    return form.RunWithContext(ctx)
}

Benefits

Consistency: All Charm libraries use same GitLab colors Maintainability: Single source of truth Extensibility: Easy to add more Charm libraries (bubbles, etc.) Branding: Maintains GitLab identity across all TUI elements DRY: No color duplication

Implementation Tasks

  • Create internal/theme/gitlab.go
  • Define GitLabColors struct
  • Implement FangColorScheme()
  • Implement HuhTheme() with GitLab colors
  • Refactor cmd/glab/main.go to use shared theme
  • Update internal/iostreams/iostreams.go to apply theme
  • Test visual consistency across fang and huh components
  • Document theme customization in CONTRIBUTING.md

Related

  • Epic: #19748 (TUI Migration)
  • !2408 (merged) (Original fang color scheme implementation)
  • Phase 1 huh migration will benefit from this

Acceptance Criteria

  • GitLab colors defined in one place
  • Fang continues to use GitLab theme
  • Huh prompts use matching GitLab theme
  • Visual consistency across all TUI components
  • Tests pass
  • Documentation updated

Priority: Should be done before or alongside huh migration phases to ensure consistent branding from the start.