aboutsummaryrefslogtreecommitdiff
path: root/internal/game/color.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/color.go')
-rw-r--r--internal/game/color.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/game/color.go b/internal/game/color.go
new file mode 100644
index 0000000..45df212
--- /dev/null
+++ b/internal/game/color.go
@@ -0,0 +1,22 @@
+package game
+
+import (
+ "thirdcollapse/internal/color"
+ "thirdcollapse/internal/net"
+ "thirdcollapse/internal/player"
+)
+
+func (g *Game) colorMode(sess *net.Session) string {
+ if p, ok := sess.Player.(*player.Player); ok && p != nil {
+ return p.OptionString("color")
+ }
+ return "none"
+}
+
+func (g *Game) colorize(sess *net.Session, name, text string) string {
+ return color.Wrap(g.colorMode(sess), name, text)
+}
+
+func (g *Game) colorTag(sess *net.Session, text string) string {
+ return color.Tag(g.colorMode(sess), text)
+}