style

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Text styles using pterm
	TitleStyle    = pterm.NewStyle(pterm.Bold)
	SubtitleStyle = pterm.NewStyle(pterm.Bold)
	MutedStyle    = pterm.NewStyle(pterm.FgGray)

	// PowerUp styles with custom colors
	SymlinkStyle       = pterm.NewStyle(pterm.FgLightBlue, pterm.Bold)
	ProfileStyle       = pterm.NewStyle(pterm.FgMagenta, pterm.Bold)
	InstallScriptStyle = pterm.NewStyle(pterm.FgYellow, pterm.Bold)
	HomebrewStyle      = pterm.NewStyle(pterm.FgGreen, pterm.Bold)
	ConfigStyle        = pterm.NewStyle(pterm.FgCyan) // For .dodot.toml files

	// Path style
	PathStyle = pterm.NewStyle(pterm.FgGray, pterm.Italic)
)

Create pterm styles for our use cases

View Source
var (
	SuccessIndicator  = "✓"
	ErrorIndicator    = "✗"
	WarningIndicator  = "!"
	InfoIndicator     = "•"
	PendingIndicator  = "○"
	ProgressIndicator = "⟳"
)

Operation indicators - use the Unicode symbols directly

View Source
var (
	// Primary colors
	PrimaryColor = lipgloss.AdaptiveColor{
		Light: "#007ACC",
		Dark:  "#3D9EFF",
	}

	SecondaryColor = lipgloss.AdaptiveColor{
		Light: "#6C757D",
		Dark:  "#A0A8B0",
	}

	// Status colors
	SuccessColor = lipgloss.AdaptiveColor{
		Light: "#28A745",
		Dark:  "#4CDD76",
	}

	ErrorColor = lipgloss.AdaptiveColor{
		Light: "#DC3545",
		Dark:  "#FF6B7D",
	}

	WarningColor = lipgloss.AdaptiveColor{
		Light: "#FFC107",
		Dark:  "#FFD54F",
	}

	InfoColor = lipgloss.AdaptiveColor{
		Light: "#17A2B8",
		Dark:  "#4DD0E1",
	}

	// Text colors
	HeadingColor = lipgloss.AdaptiveColor{
		Light: "#212529",
		Dark:  "#F8F9FA",
	}

	TextColor = lipgloss.AdaptiveColor{
		Light: "#495057",
		Dark:  "#E9ECEF",
	}

	MutedColor = lipgloss.AdaptiveColor{
		Light: "#6C757D",
		Dark:  "#ADB5BD",
	}

	// Background colors
	BackgroundColor = lipgloss.AdaptiveColor{
		Light: "#FFFFFF",
		Dark:  "#1A1B26",
	}

	SurfaceColor = lipgloss.AdaptiveColor{
		Light: "#F8F9FA",
		Dark:  "#24253A",
	}

	BorderColor = lipgloss.AdaptiveColor{
		Light: "#DEE2E6",
		Dark:  "#3B3C4F",
	}
)

Color definitions using AdaptiveColor for automatic light/dark mode switching

View Source
var (
	SymlinkColor = lipgloss.AdaptiveColor{
		Light: "#0EA5E9",
		Dark:  "#38BDF8",
	}

	ProfileColor = lipgloss.AdaptiveColor{
		Light: "#8B5CF6",
		Dark:  "#A78BFA",
	}

	InstallScriptColor = lipgloss.AdaptiveColor{
		Light: "#F59E0B",
		Dark:  "#FBBF24",
	}

	HomebrewColor = lipgloss.AdaptiveColor{
		Light: "#10B981",
		Dark:  "#34D399",
	}
)

PowerUp specific colors

View Source
var (
	BoxStyle = lipgloss.NewStyle().
		Border(lipgloss.RoundedBorder()).
		BorderForeground(BorderColor).
		Padding(1, 2)
)

Lipgloss styles for more complex layouts (boxes, etc)

View Source
var PowerUpVerbs = map[string]struct {
	Past   string
	Future string
}{
	"symlink":  {Past: "linked to", Future: "will be linked to"},
	"profile":  {Past: "included in", Future: "to be included in"},
	"homebrew": {Past: "executed on", Future: "to be installed"},
	"path":     {Past: "added to", Future: "to be added to"},
	"install":  {Past: "executed during installation on", Future: "to be executed"},
	"config":   {Past: "found", Future: "found"},
}

PowerUpVerbs defines past and future tense verbs for each power-up type

Functions

func Bold

func Bold(s string) string

func Indent

func Indent(s string, level int) string

Helper functions using pterm

func Italic

func Italic(s string) string

func RenderFileStatus

func RenderFileStatus(fs FileStatus) string

RenderFileStatus renders a single file status line

func RenderPackStatus

func RenderPackStatus(ps PackStatus) string

RenderPackStatus renders a complete pack status

func StatusStyle

func StatusStyle(status Status) *pterm.Style

StatusStyle returns the appropriate pterm style for a status

func Underline

func Underline(s string) string

Types

type FileStatus

type FileStatus struct {
	PowerUp    string // Power-up type (symlink, profile, etc.)
	FilePath   string // File path relative to pack
	Status     Status // Current status
	Target     string // Target path (for symlinks, etc.)
	Date       string // Date of execution (for past tense)
	IsOverride bool   // True if filename was overridden in config
}

FileStatus represents the status of a single file in a pack

type PackStatus

type PackStatus struct {
	Name      string
	Status    Status // Aggregated status
	HasConfig bool
	IsIgnored bool
	Files     []FileStatus
}

PackStatus represents the status of an entire pack

func ConvertDisplayPackToPackStatus

func ConvertDisplayPackToPackStatus(pack types.DisplayPack) PackStatus

ConvertDisplayPackToPackStatus converts from types.DisplayPack to style.PackStatus This bridges the new DisplayResult model with the existing style rendering

type PlainRenderer

type PlainRenderer struct{}

PlainRenderer implements Renderer with plain text output (no styling)

func NewPlainRenderer

func NewPlainRenderer() *PlainRenderer

NewPlainRenderer creates a new plain text renderer

func (*PlainRenderer) RenderError

func (r *PlainRenderer) RenderError(err error) string

RenderError renders a plain error message

func (*PlainRenderer) RenderOperations

func (r *PlainRenderer) RenderOperations(ops []types.Operation) string

RenderOperations renders plain operations

func (*PlainRenderer) RenderPackList

func (r *PlainRenderer) RenderPackList(packs []types.PackInfo) string

RenderPackList renders a plain list of packs

func (*PlainRenderer) RenderPackStatuses

func (r *PlainRenderer) RenderPackStatuses(packs []PackStatus) string

RenderPackStatuses renders multiple pack statuses in plain text

func (*PlainRenderer) RenderProgress

func (r *PlainRenderer) RenderProgress(current, total int, message string) string

RenderProgress renders plain progress

type Renderer

type Renderer interface {
	RenderPackList(packs []types.PackInfo) string
	RenderOperations(ops []types.Operation) string
	RenderError(err error) string
	RenderProgress(current, total int, message string) string
	RenderPackStatuses(packs []PackStatus) string
}

Renderer defines the interface for rendering various output types

type Status

type Status string

Status types for files and packs

const (
	StatusSuccess Status = "success" // Deployed/installed successfully
	StatusError   Status = "error"   // Deploy/install failed
	StatusQueue   Status = "queue"   // To be deployed/installed
	StatusAlert   Status = "alert"   // Pack has errors (pack-level only)
	StatusIgnored Status = "ignored" // Directory is ignored
	StatusConfig  Status = "config"  // Config file found
)

func AggregatePackStatus

func AggregatePackStatus(files []FileStatus) Status

AggregatePackStatus determines the overall status of a pack based on its files

type TerminalRenderer

type TerminalRenderer struct {
	// contains filtered or unexported fields
}

TerminalRenderer implements Renderer with rich terminal output

func NewTerminalRenderer

func NewTerminalRenderer() *TerminalRenderer

NewTerminalRenderer creates a new terminal renderer

func (*TerminalRenderer) RenderError

func (r *TerminalRenderer) RenderError(err error) string

RenderError renders an error message

func (*TerminalRenderer) RenderOperations

func (r *TerminalRenderer) RenderOperations(ops []types.Operation) string

RenderOperations renders a list of operations

func (*TerminalRenderer) RenderPackList

func (r *TerminalRenderer) RenderPackList(packs []types.PackInfo) string

RenderPackList renders a list of packs

func (*TerminalRenderer) RenderPackStatuses

func (r *TerminalRenderer) RenderPackStatuses(packs []PackStatus) string

RenderPackStatuses renders multiple pack statuses

func (*TerminalRenderer) RenderProgress

func (r *TerminalRenderer) RenderProgress(current, total int, message string) string

RenderProgress renders a progress indicator

func (*TerminalRenderer) SetWidth

func (r *TerminalRenderer) SetWidth(width int)

SetWidth updates the terminal width for rendering

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL