From 81b8f94111d5f517b24f7790075ba73b5f910463 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 9 May 2024 11:20:07 -0300 Subject: [PATCH] feat: Profile.Name() (#163) allows to get the profile name, useful for logs/errors. Signed-off-by: Carlos Alexandro Becker --- profile.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/profile.go b/profile.go index fa128e2..607faba 100644 --- a/profile.go +++ b/profile.go @@ -22,6 +22,21 @@ const ( Ascii //nolint:revive ) +// Name returns the profile name as a string. +func (p Profile) Name() string { + switch p { + case Ascii: + return "Ascii" + case ANSI: + return "ANSI" + case ANSI256: + return "ANSI256" + case TrueColor: + return "TrueColor" + } + return "Unknown" +} + // String returns a new Style. func (p Profile) String(s ...string) Style { return Style{