From e2d29aa9d8c53056fee3e209d06fd72a8404ae15 Mon Sep 17 00:00:00 2001 From: ruinivist Date: Sat, 21 Mar 2026 05:35:10 +0000 Subject: [PATCH] refactor: use a dedicated color palette struct --- internal/output/output.go | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/internal/output/output.go b/internal/output/output.go index caf9f2c..fd01894 100644 --- a/internal/output/output.go +++ b/internal/output/output.go @@ -8,18 +8,32 @@ import ( ) const ( - bold = "\x1b[1m" - italic = "\x1b[3m" - wordmark = "\x1b[38;2;112;224;0m" - chevron = "\x1b[38;2;29;211;176m" - reset = "\x1b[0m" - prefix = wordmark + bold + italic + "miro" + reset + " " + chevron + bold + italic + "›" + reset + " " + bold = "\x1b[1m" + italic = "\x1b[3m" + reset = "\x1b[0m" +) + +var ( + palette = struct { + miroPrefixGreen uint32 + miroChevronTeal uint32 + }{ + miroPrefixGreen: 0x70E000, + miroChevronTeal: 0x1DD3B0, + } + + chevron = ansiColor(palette.miroChevronTeal) + prefix = ansiColor(palette.miroPrefixGreen) + bold + italic + "miro" + reset + " " + chevron + bold + italic + "›" + reset + " " ) func Prefix() string { return prefix } +func ansiColor(rgb uint32) string { + return fmt.Sprintf("\x1b[38;2;%d;%d;%dm", byte(rgb>>16), byte(rgb>>8), byte(rgb)) +} + func Format(msg string) string { body := strings.TrimRight(msg, "\n") suffix := msg[len(body):]