v0.7.1 client readline removed for cross-platform compatibility with wasm, client logic fix fixes and refactor

This commit is contained in:
2025-11-13 14:31:31 -05:00
parent 6bdc061508
commit 35c49b22b6
18 changed files with 306 additions and 272 deletions

View File

@ -1,6 +1,11 @@
// FILE: lixenwraith/chess/internal/client/display/colors.go
package display
import (
"fmt"
"strings"
)
// Terminal color codes
const (
Reset = "\033[0m"
@ -13,6 +18,35 @@ const (
White = "\033[37m"
)
// C wraps text with color and reset codes
func C(color, text string) string {
return color + text + Reset
}
// Print outputs colored text immediately
func Print(color, format string, args ...any) {
fmt.Printf(C(color, format), args...)
}
// Println outputs colored text with newline
func Println(color, format string, args ...any) {
fmt.Println(C(color, fmt.Sprintf(format, args...)))
}
// Build creates a multi-colored string
type Builder struct {
parts []string
}
func (b *Builder) Add(color, text string) *Builder {
b.parts = append(b.parts, C(color, text))
return b
}
func (b *Builder) String() string {
return strings.Join(b.parts, "")
}
// Prompt returns a colored prompt string
func Prompt(text string) string {
return Yellow + text + Yellow + " > " + Reset