From 6fdc6f7e5e5b6ed4e8eeaec1b84dbd8f6f8f793d Mon Sep 17 00:00:00 2001 From: Ed Zynda Date: Thu, 26 Feb 2026 18:09:26 +0300 Subject: [PATCH] update KIT banner with KITT red gradient and simplify description --- cmd/root.go | 61 ++++++++++++---------------------- internal/ui/enhanced_styles.go | 54 +++++++++++++++++++++++++----- 2 files changed, 68 insertions(+), 47 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 2bf1a1da..fb9c3aee 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -86,34 +86,7 @@ func (a *agentUIAdapter) GetLoadedServerNames() []string { var rootCmd = &cobra.Command{ Use: "kit", Short: "Chat with AI models through a unified interface", - Long: `KIT is a CLI tool that allows you to interact with various AI models -through a unified interface. It supports various tools through MCP servers -and provides streaming responses. - -Available models can be specified using the --model flag: -- Anthropic Claude (default): anthropic/claude-sonnet-4-5-20250929 -- OpenAI: openai/gpt-4 -- Ollama models: ollama/modelname -- Google: google/modelname - -Examples: - # Interactive mode - kit -m ollama/qwen2.5:3b - kit -m openai/gpt-4 - kit -m google/gemini-2.0-flash - - # Non-interactive mode - kit -p "What is the weather like today?" - kit -p "Calculate 15 * 23" --quiet - - # Session management - kit --save-session ./my-session.json -p "Hello" - kit --load-session ./my-session.json -p "Continue our conversation" - kit --load-session ./session.json --save-session ./session.json -p "Next message" - kit --session ./session.json -p "Next message" - - # Script mode - kit script myscript.sh`, + Long: `KIT (Knowledge Inference Tool) — A lightweight AI agent for coding`, RunE: func(cmd *cobra.Command, args []string) error { return runKit(context.Background()) }, @@ -252,18 +225,28 @@ func configToUiTheme(theme config.Theme) ui.Theme { } // kitBanner returns the KIT ASCII art title with KITT scanner lights, -// rendered in KITT red using lipgloss. +// rendered with a KITT red gradient. func kitBanner() string { - style := lipgloss.NewStyle().Foreground(lipgloss.Color("#CC0000")) - banner := - " ██╗ ██╗ ██╗ ████████╗\n" + - " ██║ ██╔╝ ██║ ╚══██╔══╝\n" + - " █████╔╝ ██║ ██║\n" + - " ██╔═██╗ ██║ ██║\n" + - " ██║ ██╗ ██║ ██║\n" + - " ╚═╝ ╚═╝ ╚═╝ ╚═╝\n" + - " ░░░░░░▒▒▒▒▒▓▓▓▓███████████████▓▓▓▓▒▒▒▒▒░░░░░░" - return style.Render(banner) + kittDark := lipgloss.Color("#8B0000") + kittBright := lipgloss.Color("#FF2200") + lines := []string{ + " ██╗ ██╗ ██╗ ████████╗", + " ██║ ██╔╝ ██║ ╚══██╔══╝", + " █████╔╝ ██║ ██║", + " ██╔═██╗ ██║ ██║", + " ██║ ██╗ ██║ ██║", + " ╚═╝ ╚═╝ ╚═╝ ╚═╝", + " ░░░░░░▒▒▒▒▒▓▓▓▓███████████████▓▓▓▓▒▒▒▒▒░░░░░░", + } + + var result strings.Builder + for i, line := range lines { + if i > 0 { + result.WriteString("\n") + } + result.WriteString(ui.ApplyGradient(line, kittDark, kittBright)) + } + return result.String() } func init() { diff --git a/internal/ui/enhanced_styles.go b/internal/ui/enhanced_styles.go index 871a95f1..8d0249e1 100644 --- a/internal/ui/enhanced_styles.go +++ b/internal/ui/enhanced_styles.go @@ -4,6 +4,7 @@ import ( "fmt" "image/color" "os" + "strings" "charm.land/lipgloss/v2" ) @@ -202,15 +203,52 @@ func CreateBadge(text string, c color.Color) string { Render(text) } -// CreateGradientText creates styled text with a gradient-like effect. Currently -// implements a simplified version using the start color only, as true gradients -// require more complex terminal capabilities. +// interpolateColor blends between two colors based on position (0.0 to 1.0) +// using linear RGB channel interpolation. +func interpolateColor(a, b color.Color, pos float64) color.Color { + r1, g1, b1, _ := a.RGBA() + r2, g2, b2, _ := b.RGBA() + + r := uint8(float64(r1>>8)*(1-pos) + float64(r2>>8)*pos) + g := uint8(float64(g1>>8)*(1-pos) + float64(g2>>8)*pos) + bl := uint8(float64(b1>>8)*(1-pos) + float64(b2>>8)*pos) + + return lipgloss.Color(fmt.Sprintf("#%02x%02x%02x", r, g, bl)) +} + +// ApplyGradient applies a color gradient from colorA to colorB across the text. +// Uses ~8 color stops for performance rather than per-character coloring. +func ApplyGradient(text string, colorA, colorB color.Color) string { + runes := []rune(text) + if len(runes) == 0 { + return text + } + + const maxStops = 8 + segmentSize := len(runes) / maxStops + if segmentSize < 1 { + segmentSize = 1 + } + + var result strings.Builder + for i := 0; i < len(runes); i += segmentSize { + end := i + segmentSize + if end > len(runes) { + end = len(runes) + } + + pos := float64(i) / float64(len(runes)) + c := interpolateColor(colorA, colorB, pos) + style := lipgloss.NewStyle().Foreground(c) + result.WriteString(style.Render(string(runes[i:end]))) + } + + return result.String() +} + +// CreateGradientText creates styled text with a gradient effect between two colors. func CreateGradientText(text string, startColor, endColor color.Color) string { - // For now, just use the start color - true gradients would require more complex implementation - return lipgloss.NewStyle(). - Foreground(startColor). - Bold(true). - Render(text) + return ApplyGradient(text, startColor, endColor) } // Compact styling utilities