Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateColumnWidths(headers []string, data [][]string, terminalWidth int) []int
- func CalculateStatusColumnWidths(headers []string, data [][]string, terminalWidth int) []int
- func CreateRepositoryTable(headers []string, data [][]string, highlightRepo string) *table.Table
- func CreateStatusTable(headers []string, data [][]string) *table.Table
- func CreateSummaryTable(summaryData [][]string) *table.Table
- func FormatNumericCompact(str string, maxWidth int) string
- func GetStatusColor(status string, isDimmed bool) lipgloss.Color
- func GetTerminalWidth() int
- func GetThemeColors() (statusColors, dimStatusColors map[string]string, ...)
- func InitializeStyles()
- func SetTheme(theme Theme)
- func TruncateString(str string, maxWidth int) string
- type Theme
Constants ¶
const ( DarkThemeName = "dark" LightThemeName = "light" )
const ( // Dark theme - Primary colors DarkColorWhite = "#cdd6f4" // Mocha Text DarkColorBlack = "#1e1e2e" // Mocha Base DarkColorGray = "#9399b2" // Mocha Overlay 2 DarkColorLightGray = "#a6adc8" // Mocha Subtext 0 DarkColorDarkGray = "#45475a" // Mocha Surface 1 // Dark theme - Status colors (Catppuccin Mocha) DarkColorGrassGreen = "#a6e3a1" // Clean status - Mocha Green DarkColorElectricYellow = "#f9e2af" // Modified status - Mocha Yellow DarkColorFireRed = "#f38ba8" // Error status - Mocha Red DarkColorFlyingPink = "#f5c2e7" // Warning status - Mocha Pink DarkColorWaterCyan = "#89dceb" // Created status - Mocha Sky DarkColorPoisonPurple = "#cba6f7" // Deleted status - Mocha Mauve // Dark theme - Dimmed status colors DarkColorDimGreen = "#94e2d5" // Mocha Teal DarkColorPeach = "#fab387" // Mocha Peach DarkColorDimRed = "#eba0ac" // Mocha Maroon DarkColorDimPink = "#f2cdcd" // Mocha Flamingo DarkColorDimCyan = "#74c7ec" // Mocha Sapphire DarkColorDimPurple = "#b4befe" // Mocha Lavender // Dark theme - Highlight colors DarkColorSelectedGreen = "#a6e3a1" // Mocha Green DarkColorSelectedDark = "#313244" // Mocha Surface 0 // Dark theme - Terminal colors DarkColorTerminalBlue = "12" DarkColorTerminalLightBlue = "159" DarkColorTerminalCyan = "14" DarkColorTerminalGreen = "10" DarkColorTerminalYellow = "11" DarkColorTerminalRed = "9" DarkColorTerminalMagenta = "13" DarkColorTerminalPurple = "129" DarkColorTerminalGray = "8" DarkColorTerminalLightGray = "245" DarkColorTerminalWhite = "252" DarkColorTerminalBorder = "238" )
Dark Theme Color Constants (Catppuccin Mocha)
const ( // Light theme - Primary colors LightColorWhite = "#eff1f5" // Latte Base LightColorBlack = "#4c4f69" // Latte Text LightColorGray = "#6c6f85" // Latte Subtext 0 LightColorLightGray = "#7c7f93" // Latte Overlay 2 LightColorDarkGray = "#5c5f77" // Latte Subtext 1 // Light theme - Status colors (Catppuccin Latte) LightColorGrassGreen = "#40a02b" // Clean status - Latte Green LightColorElectricYellow = "#df8e1d" // Modified status - Latte Yellow LightColorFireRed = "#d20f39" // Error status - Latte Red LightColorFlyingPink = "#ea76cb" // Warning status - Latte Pink LightColorWaterCyan = "#04a5e5" // Created status - Latte Sky LightColorPoisonPurple = "#8839ef" // Deleted status - Latte Mauve // Light theme - Dimmed status colors LightColorDimGreen = "#179299" // Latte Teal LightColorPeach = "#fe640b" // Latte Peach LightColorDimRed = "#e64553" // Latte Maroon LightColorDimPink = "#dd7878" // Latte Flamingo LightColorDimCyan = "#209fb5" // Latte Sapphire LightColorDimPurple = "#7287fd" // Latte Lavender // Light theme - Highlight colors LightColorSelectedGreen = "#40a02b" // Latte Green LightColorSelectedLight = "#e6e9ef" // Latte Mantle // Light theme - Terminal colors (darker for better contrast on light backgrounds) LightColorTerminalBlue = "4" // Darker blue LightColorTerminalLightBlue = "153" // Light blue LightColorTerminalCyan = "6" // Darker cyan LightColorTerminalGreen = "2" // Darker green LightColorTerminalYellow = "3" // Darker yellow LightColorTerminalRed = "1" // Darker red LightColorTerminalMagenta = "5" // Darker magenta LightColorTerminalPurple = "93" // Darker purple LightColorTerminalGray = "240" // Darker gray LightColorTerminalLightGray = "250" // Medium gray LightColorTerminalWhite = "0" // Black for text LightColorTerminalBorder = "244" // Medium border )
Light Theme Color Constants (Catppuccin Latte)
const ( // Status color keys ColorKeyClean = "Clean" ColorKeyModified = "Modified" ColorKeyError = "Error" ColorKeyWarning = "Warning" ColorKeyCreated = "Created" ColorKeyDeleted = "Deleted" ColorKeyNormal = "Normal" // Terminal color keys ColorKeyBlue = "Blue" ColorKeyLightBlue = "LightBlue" ColorKeyCyan = "Cyan" ColorKeyGreen = "Green" ColorKeyYellow = "Yellow" ColorKeyRed = "Red" ColorKeyMagenta = "Magenta" ColorKeyPurple = "Purple" ColorKeyGray = "Gray" ColorKeyLightGray = "LightGray" ColorKeyWhite = "White" ColorKeyBorder = "Border" ColorKeySelectedFg = "SelectedFg" ColorKeySelectedBg = "SelectedBg" ColorKeyPeach = "Peach" )
Theme color key constants
Variables ¶
var ( // Renderer for consistent styling Renderer = lipgloss.NewRenderer(os.Stdout) // Table styles inspired by Pokemon example BaseTableStyle = Renderer.NewStyle().Padding(0, 1) // These will be initialized by InitializeStyles() HeaderTableStyle lipgloss.Style SelectedTableStyle lipgloss.Style StatusColors map[string]lipgloss.Color DimStatusColors map[string]lipgloss.Color TitleStyle lipgloss.Style SeparatorStyle lipgloss.Style SuccessStyle lipgloss.Style WarningStyle lipgloss.Style ErrorStyle lipgloss.Style RepoStyle lipgloss.Style PathStyle lipgloss.Style LabelStyle lipgloss.Style HighlightStyle lipgloss.Style SummaryStyle lipgloss.Style SectionStyle lipgloss.Style CreatedStyle lipgloss.Style EditedStyle lipgloss.Style DeletedStyle lipgloss.Style MenuTitleStyle lipgloss.Style MenuItemStyle lipgloss.Style SelectedMenuItemStyle lipgloss.Style CheckedStyle lipgloss.Style UncheckedStyle lipgloss.Style HelpStyle lipgloss.Style SelectedGroupsStyle lipgloss.Style )
Define beautiful styles using lipgloss with better cross-terminal compatibility
var CurrentTheme = ThemeDark // Default to dark theme
Functions ¶
func CalculateColumnWidths ¶ added in v1.0.0
CalculateColumnWidths calculates optimal column widths based on terminal size
func CalculateStatusColumnWidths ¶ added in v1.2.0
CalculateStatusColumnWidths calculates optimal column widths for status table with specific optimization for Repository, Branch, ➕(Created), ✎(Modified), ➖(Deleted), Status, Path
func CreateRepositoryTable ¶ added in v1.0.0
CreateRepositoryTable creates a table specifically for repository operations
func CreateStatusTable ¶ added in v1.0.0
CreateStatusTable creates a beautiful table for displaying repository status
func CreateSummaryTable ¶ added in v1.0.0
CreateSummaryTable creates a summary table for execution results
func FormatNumericCompact ¶ added in v1.2.0
FormatNumericCompact formats numbers for compact display in small columns
func GetStatusColor ¶ added in v1.0.0
GetStatusColor returns the appropriate color for a status
func GetTerminalWidth ¶ added in v1.0.0
func GetTerminalWidth() int
GetTerminalWidth returns the current terminal width
func GetThemeColors ¶ added in v1.0.0
func GetThemeColors() (statusColors, dimStatusColors map[string]string, terminalColors map[string]string)
Theme helper functions
func InitializeStyles ¶ added in v1.0.0
func InitializeStyles()
InitializeStyles recreates all styles with current theme colors
func SetTheme ¶ added in v1.0.0
func SetTheme(theme Theme)
SetTheme changes the current theme and reinitializes styles
func TruncateString ¶ added in v1.0.0
TruncateString truncates a string to fit within a given width