theme

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package theme provides Dracula color palette and lipgloss styles for the hex TUI. ABOUTME: Dracula theme color palette and lipgloss styles for the hex TUI ABOUTME: Provides consistent color scheme throughout the application

Package theme provides Neo-Terminal color palette and lipgloss styles for the hex TUI. ABOUTME: Neo-Terminal theme - sophisticated, information-rich terminal design ABOUTME: Celebrates modern terminal capabilities with elegant typography and rich visual hierarchy

Index

Examples

Constants

View Source
const (
	// Background colors
	Background  = "#282a36"
	CurrentLine = "#44475a"
	Selection   = "#44475a"

	// Foreground colors
	Foreground = "#f8f8f2"
	Comment    = "#6272a4"

	// Accent colors
	Cyan   = "#8be9fd"
	Green  = "#50fa7b"
	Orange = "#ffb86c"
	Pink   = "#ff79c6"
	Purple = "#bd93f9"
	Red    = "#ff5555"
	Yellow = "#f1fa8c"
)

Dracula color palette constants Official Dracula theme specification from https://draculatheme.com/contribute

View Source
const (
	// Primary Palette
	DeepInk     = "#1a1b26" // Background - rich black-blue
	SoftPaper   = "#c0caf5" // Primary text - cool white
	AccentCoral = "#ff9e64" // User messages - warm
	AccentSage  = "#9ece6a" // Assistant - natural green
	AccentSky   = "#7aa2f7" // Tools/system - cool blue

	// Secondary Palette
	DimInk       = "#565f89" // Borders, secondary text
	Ghost        = "#414868" // Subtle elements
	WarningAmber = "#e0af68" // Warnings
	ErrorRuby    = "#f7768e" // Errors
	SuccessJade  = "#73daca" // Success states
)

Neo-Terminal color palette - Information-rich sophistication Inspired by Swiss typography meets cyberdeck aesthetics

Variables

This section is empty.

Functions

This section is empty.

Types

type Theme

type Theme struct {
	// Color references (for direct use when needed)
	Colors struct {
		Background  lipgloss.Color
		CurrentLine lipgloss.Color
		Foreground  lipgloss.Color
		Comment     lipgloss.Color
		Cyan        lipgloss.Color
		Green       lipgloss.Color
		Orange      lipgloss.Color
		Pink        lipgloss.Color
		Purple      lipgloss.Color
		Red         lipgloss.Color
		Yellow      lipgloss.Color
	}

	// Text styles
	Title      lipgloss.Style
	Subtitle   lipgloss.Style
	Body       lipgloss.Style
	Muted      lipgloss.Style
	Emphasized lipgloss.Style

	// Status styles
	Success lipgloss.Style
	Error   lipgloss.Style
	Warning lipgloss.Style
	Info    lipgloss.Style

	// Interactive element styles
	Border        lipgloss.Style
	BorderFocused lipgloss.Style
	Input         lipgloss.Style
	InputFocused  lipgloss.Style
	Button        lipgloss.Style
	ButtonActive  lipgloss.Style

	// Specialized component styles
	StatusBar    lipgloss.Style
	ViewMode     lipgloss.Style
	SearchPrompt lipgloss.Style
	TokenCounter lipgloss.Style

	// Tool-related styles
	ToolApproval  lipgloss.Style
	ToolExecuting lipgloss.Style
	ToolSuccess   lipgloss.Style
	ToolError     lipgloss.Style
	ToolResult    lipgloss.Style
	ToolCall      lipgloss.Style

	// Suggestion styles
	SuggestionBox    lipgloss.Style
	SuggestionTitle  lipgloss.Style
	SuggestionReason lipgloss.Style
	SuggestionHint   lipgloss.Style

	// List and selection styles
	ListItem         lipgloss.Style
	ListItemSelected lipgloss.Style
	ListItemActive   lipgloss.Style

	// Autocomplete dropdown styles
	AutocompleteDropdown lipgloss.Style
	AutocompleteItem     lipgloss.Style
	AutocompleteSelected lipgloss.Style
	AutocompleteHelp     lipgloss.Style

	// Help and modal styles
	HelpPanel  lipgloss.Style
	HelpKey    lipgloss.Style
	HelpDesc   lipgloss.Style
	Modal      lipgloss.Style
	ModalTitle lipgloss.Style

	// Code and syntax styles
	Code      lipgloss.Style
	CodeBlock lipgloss.Style
	Keyword   lipgloss.Style
	String    lipgloss.Style
	Number    lipgloss.Style

	// Link and reference styles
	Link      lipgloss.Style
	LinkHover lipgloss.Style

	// Message styles
	UserMessage      lipgloss.Style
	AssistantMessage lipgloss.Style
	ThinkingMessage  lipgloss.Style

	// Queue indicator style
	QueueIndicator lipgloss.Style
	QueuedMessage  lipgloss.Style
}

Theme provides a complete set of lipgloss styles for the UI

func DraculaTheme

func DraculaTheme() *Theme

DraculaTheme returns a pre-configured Dracula theme instance This is the recommended way to get a theme for use in the application

Example

ExampleDraculaTheme demonstrates basic usage of the Dracula theme

package main

import (
	"fmt"

	"github.com/2389-research/hex/internal/ui/theme"
)

func main() {
	// Create a new Dracula theme instance
	t := theme.DraculaTheme()

	// Use the theme to style text
	title := t.Title.Render("Welcome to Hex")
	subtitle := t.Subtitle.Render("A beautiful CLI interface")
	body := t.Body.Render("This is some body text")

	fmt.Println(title)
	fmt.Println(subtitle)
	fmt.Println(body)
}
Example (Code)

ExampleDraculaTheme_code demonstrates code styling

package main

import (
	"fmt"

	"github.com/2389-research/hex/internal/ui/theme"
)

func main() {
	t := theme.DraculaTheme()

	// Code elements
	inlineCode := t.Code.Render("inline_code()")
	keyword := t.Keyword.Render("func")
	str := t.String.Render(`"hello world"`)
	num := t.Number.Render("42")

	fmt.Printf("%s %s = %s + %s\n", keyword, inlineCode, str, num)
}
Example (DirectColorAccess)

ExampleDraculaTheme_directColorAccess demonstrates using colors directly

package main

import (
	"fmt"

	"github.com/2389-research/hex/internal/ui/theme"
)

func main() {
	t := theme.DraculaTheme()

	// Access colors directly for custom styling
	fmt.Printf("Purple: %s\n", t.Colors.Purple)
	fmt.Printf("Pink: %s\n", t.Colors.Pink)
	fmt.Printf("Cyan: %s\n", t.Colors.Cyan)
	fmt.Printf("Green: %s\n", t.Colors.Green)
}
Example (Lists)

ExampleDraculaTheme_lists demonstrates list item styling

package main

import (
	"fmt"

	"github.com/2389-research/hex/internal/ui/theme"
)

func main() {
	t := theme.DraculaTheme()

	// List items with different states
	normalItem := t.ListItem.Render("Regular list item")
	selectedItem := t.ListItemSelected.Render("Selected item")
	activeItem := t.ListItemActive.Render("Active item")

	fmt.Println(normalItem)
	fmt.Println(selectedItem)
	fmt.Println(activeItem)
}
Example (StatusIndicators)

ExampleDraculaTheme_statusIndicators demonstrates status styling

package main

import (
	"fmt"

	"github.com/2389-research/hex/internal/ui/theme"
)

func main() {
	t := theme.DraculaTheme()

	// Different status indicators
	success := t.Success.Render("✓ Operation successful")
	errorMsg := t.Error.Render("✗ Operation failed")
	warning := t.Warning.Render("⚠ Warning: Check this")
	info := t.Info.Render("ℹ Information")

	fmt.Println(success)
	fmt.Println(errorMsg)
	fmt.Println(warning)
	fmt.Println(info)
}
Example (ToolStates)

ExampleDraculaTheme_toolStates demonstrates tool execution states

package main

import (
	"fmt"

	"github.com/2389-research/hex/internal/ui/theme"
)

func main() {
	t := theme.DraculaTheme()

	// Tool execution states
	approval := t.ToolApproval.Render("Approve tool execution?")
	executing := t.ToolExecuting.Render("⏳ Executing bash command...")
	success := t.ToolSuccess.Render("✓ Tool executed successfully")
	failed := t.ToolError.Render("✗ Tool execution failed")

	fmt.Println(approval)
	fmt.Println(executing)
	fmt.Println(success)
	fmt.Println(failed)
}

func NeoTerminalTheme added in v1.5.0

func NeoTerminalTheme() *Theme

NeoTerminalTheme returns a pre-configured Neo-Terminal theme instance This is the recommended way to get a theme for use in the application

func NewDraculaTheme

func NewDraculaTheme() *Theme

NewDraculaTheme creates and returns a new Dracula theme with all styles initialized

func NewNeoTerminalTheme added in v1.5.0

func NewNeoTerminalTheme() *Theme

NewNeoTerminalTheme creates and returns a new Neo-Terminal theme with all styles initialized

Jump to

Keyboard shortcuts

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