From 87ab517bea29c7b1e4493f9316e96e619b1009d4 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Fri, 16 Dec 2022 21:44:05 +0300 Subject: [PATCH] Make BasicColor check no_color --- src/color.v | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/color.v b/src/color.v index 467c2d3..ebcc397 100644 --- a/src/color.v +++ b/src/color.v @@ -56,7 +56,22 @@ fn (c TrueColor) render_bg(str string) string { } struct BasicColor { -pub: - render fn (string) string - render_bg fn (string) string + render_fn fn (string) string + render_bg_fn fn (string) string +} + +fn (c BasicColor) render(str string) string { + return if no_color { + str + } else { + c.render_fn(str) + } +} + +fn (c BasicColor) render_bg(str string) string { + return if no_color { + str + } else { + c.render_bg_fn(str) + } }