diff options
| author | historia <[not public]> | 2026-06-16 23:37:50 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-16 23:37:50 -0400 |
| commit | 389e307f205f9b7edf604fb9f86e1038ead736ef (patch) | |
| tree | 595095b5877cc2b0513d31fb126303d8796cc311 /internal/game/cmd_color.go | |
| parent | 085e728d22a3369bd110b77409914cfbe9ebe611 (diff) | |
| download | thehouseoficarus-389e307f205f9b7edf604fb9f86e1038ead736ef.tar.gz | |
feat: major xterm256 color overhaul, see worldbuilding docs.
Diffstat (limited to 'internal/game/cmd_color.go')
| -rw-r--r-- | internal/game/cmd_color.go | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/internal/game/cmd_color.go b/internal/game/cmd_color.go index 7a208a2..1dd14fa 100644 --- a/internal/game/cmd_color.go +++ b/internal/game/cmd_color.go @@ -4,10 +4,10 @@ import ( "fmt" "strings" - "thirdcollapse/internal/color" - "thirdcollapse/internal/config" - "thirdcollapse/internal/net" - "thirdcollapse/internal/player" + "thehouseoficarus/internal/color" + "thehouseoficarus/internal/config" + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/player" ) func (g *Game) doColor(sess *net.Session, input string) { @@ -57,8 +57,8 @@ func (g *Game) doColor(sess *net.Session, input string) { spec := color.Parse(value) if spec.Empty() && value != "" { sess.WriteLine(fmt.Sprintf("\nInvalid color string: %s", value)) - sess.WriteLine("Format: fg=<color> bg=<color> bold dim italic underline") - sess.WriteLine("Example: fg=green bg=black bold") + sess.WriteLine("Format: <0-255> [bg:<0-255>] [bold] [dim] [underline]") + sess.WriteLine("Example: 208 bold") return } @@ -150,17 +150,40 @@ var colorCategoryOrder = []string{ "victory", "miss", "error", + "say", + "dialog", + "broadcast", + "fire", + "eat_food", + "drop_message", + "credits_pickup", } func showColorTable(g *Game, sess *net.Session) { p := sess.Player.(*player.Player) + mode := g.colorMode(sess) table := &Table{ - Columns: []string{"Target", "Color", "Source"}, + Columns: []string{ + color.Render(mode, color.Parse("75"), "Target"), + "Color", + color.Render(mode, color.Parse("243"), "Source"), + }, } for _, cat := range colorCategoryOrder { val := g.getCurrentColor(sess, cat) source := g.colorSource(sess, cat) - table.Rows = append(table.Rows, []string{cat, val, source}) + coloredVal := val + if val != "off" && val != "" { + spec := color.Parse(val) + if !spec.Empty() { + coloredVal = color.Render(mode, spec, val) + } + } + table.Rows = append(table.Rows, []string{ + color.Render(mode, color.Parse("75"), cat), + coloredVal, + color.Render(mode, color.Parse("243"), source), + }) } for _, line := range table.Render(p.OptionBool("unicode")) { sess.WriteLine(line) |
