1
Fork 0
mirror of https://github.com/RGBCube/color.v synced 2025-08-01 10:27:45 +00:00

Add util methods to Style

This commit is contained in:
RGBCube 2022-11-18 20:38:37 +03:00
parent 6e5132e353
commit 52b16209c7

View file

@ -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))
}