From 52b16209c71d154a076eeb634be2081a04d91d84 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Fri, 18 Nov 2022 20:38:37 +0300 Subject: [PATCH] Add util methods to Style --- color/style.v | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/color/style.v b/color/style.v index 97f4067..b2b1e02 100644 --- a/color/style.v +++ b/color/style.v @@ -15,7 +15,7 @@ enum Style { strikethrough } -pub fn (s Style) color(msg string) string { +pub fn (s Style) render(msg string) string { func := match s { .reset { term.reset } .bold { term.bold } @@ -30,3 +30,11 @@ pub fn (s Style) color(msg string) string { } return func(msg) } + +pub fn (s Style) cprint(msg string) { + print(s.render(msg)) +} + +pub fn (s Style) cprintln(msg string) { + println(s.render(msg)) +}