Skip to content

Refactor theme definitions to reduce duplication #19

Description

@davidnbr

Description

Both Dashboard and HighContrast themes in getTheme() have nearly identical style definitions (~50 lines duplicated).

Location

main.go:182-238

Suggestion

Extract common styles into a base function:

func baseStyles() Theme {
    return Theme{
        HeaderPlan: lipgloss.NewStyle().Bold(true)...,
        // ... common styles
    }
}

func getTheme(mode RenderingMode) Theme {
    t := baseStyles()
    if mode == RenderingModeHighContrast {
        // Override specific styles only
    }
    t.ErrorReplacer = createGuideReplacer(t.Error)
    t.WarningReplacer = createGuideReplacer(t.Warning)
    return t
}

Impact

  • Easier maintenance
  • Single source of truth for shared styles
  • ~50 lines reduction

Created from code review of fix_errors_format_default branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions