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:
parent
6e5132e353
commit
52b16209c7
1 changed files with 9 additions and 1 deletions
|
@ -15,7 +15,7 @@ enum Style {
|
||||||
strikethrough
|
strikethrough
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (s Style) color(msg string) string {
|
pub fn (s Style) render(msg string) string {
|
||||||
func := match s {
|
func := match s {
|
||||||
.reset { term.reset }
|
.reset { term.reset }
|
||||||
.bold { term.bold }
|
.bold { term.bold }
|
||||||
|
@ -30,3 +30,11 @@ pub fn (s Style) color(msg string) string {
|
||||||
}
|
}
|
||||||
return func(msg)
|
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))
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue