From 43f21aabae8924f35c12c8485e690aeefe0089fb Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 16 Jun 2026 01:59:27 -0400 Subject: feat: overhauled ansi color, added prompt options --- internal/config/config.go | 29 +++++++++++++++++++++++++++++ internal/config/doc.go | 10 ---------- 2 files changed, 29 insertions(+), 10 deletions(-) delete mode 100644 internal/config/doc.go (limited to 'internal/config') diff --git a/internal/config/config.go b/internal/config/config.go index 5c0a4b0..48f1a69 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -8,11 +8,39 @@ import ( type Config struct { Game GameConfig `yaml:"game"` + Colors ColorsConfig `yaml:"colors"` Telnet TelnetConfig `yaml:"telnet"` HTTP HTTPConfig `yaml:"http"` HTTPS HTTPSConfig `yaml:"https"` } +type ColorsConfig map[string]string + +func DefaultColors() ColorsConfig { + return ColorsConfig{ + "room_name": "fg=cyan bold", + "room_number": "dim", + "room_desc": "fg=white", + "direction": "fg=cyan", + "exit_direction": "fg=cyan", + "exit_name": "fg=green", + "mob_name": "fg=bright_red", + "friendly_npc": "fg=green", + "hostile_npc": "fg=bright_red", + "damage": "fg=red", + "enemy_hp": "fg=red", + "character_hp": "fg=green", + "xp": "fg=yellow", + "level_up": "fg=bright_yellow bold", + "item": "fg=green", + "player_name": "fg=bright_white", + "death": "fg=red bold", + "victory": "fg=green", + "miss": "dim", + "error": "fg=red", + } +} + type GameConfig struct { TickLength int `yaml:"tick_length"` } @@ -39,6 +67,7 @@ func Default() *Config { Game: GameConfig{ TickLength: 600, }, + Colors: DefaultColors(), Telnet: TelnetConfig{ Enabled: true, Port: 4000, diff --git a/internal/config/doc.go b/internal/config/doc.go deleted file mode 100644 index f35aad3..0000000 --- a/internal/config/doc.go +++ /dev/null @@ -1,10 +0,0 @@ -// Package config loads YAML server configuration and provides sensible -// defaults when no config file is present. -// -// Configuration covers three listener types: telnet (raw TCP), HTTP + WebSocket, -// and HTTPS + WebSocket. Each has an enabled flag and port. The game section -// controls display settings like max terminal width. -// -// Call Load(path) to read a YAML file merged with defaults, or Default() -// for a configuration suitable for running with telnet on :4000. -package config -- cgit v1.2.3