From 2b9f683ea32f6291c3e04b36938d60c58d273940 Mon Sep 17 00:00:00 2001 From: Ilya Eryomenko Date: Sat, 13 Jun 2026 19:59:56 +0500 Subject: [PATCH] Add color alternating for TXT records --- internal/display/display.go | 12 ++++++++---- internal/display/dns.go | 9 +++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/internal/display/display.go b/internal/display/display.go index 445b297..82bb67e 100644 --- a/internal/display/display.go +++ b/internal/display/display.go @@ -50,10 +50,11 @@ var ( faint = ac("#8C959F", "#4E4E4E") // Secondary palette tokens used across multiple files. - accent = ac("#2E59A1", "#87AFFF") // nameservers, headers, DNS records - muted = ac("#57606A", "#A8A8A8") // TXT records, redirect URLs, mail records - border = ac("#D0D7DE", "#3A3A3A") // box and panel borders - tabGray = ac("#57606A", "#A0A0A0") // inactive tab text + accent = ac("#2E59A1", "#87AFFF") // nameservers, headers, DNS records + muted = ac("#57606A", "#A8A8A8") // TXT records, redirect URLs, mail records + mutedAlt = ac("#8C959F", "#7A7A7A") // alternate TXT shade for zebra striping + border = ac("#D0D7DE", "#3A3A3A") // box and panel borders + tabGray = ac("#57606A", "#A0A0A0") // inactive tab text // Styles domainStyle = lipgloss.NewStyle(). @@ -85,6 +86,9 @@ var ( txtStyle = lipgloss.NewStyle(). Foreground(muted) + txtStyleAlt = lipgloss.NewStyle(). + Foreground(mutedAlt) + dimStyle = lipgloss.NewStyle(). Foreground(dim) diff --git a/internal/display/dns.go b/internal/display/dns.go index 4abdeaf..6507ce9 100644 --- a/internal/display/dns.go +++ b/internal/display/dns.go @@ -77,13 +77,18 @@ func RenderDNS(records *dns.Records) string { hasRecords = true b.WriteString("\n") b.WriteString(section("TXT")) - for _, txt := range records.TXT { + for i, txt := range records.TXT { // Truncate long TXT records for display display := txt if len(display) > 60 { display = display[:57] + "..." } - b.WriteString(row("", txtStyle.Render(display))) + // Alternate shades so adjacent records are easy to tell apart. + style := txtStyle + if i%2 == 1 { + style = txtStyleAlt + } + b.WriteString(row("", style.Render(display))) } }