mirror of
https://github.com/RGBCube/color.v
synced 2025-07-30 17:37:45 +00:00
Make BasicColor check no_color
This commit is contained in:
parent
6aa8a3fc47
commit
87ab517bea
1 changed files with 18 additions and 3 deletions
21
src/color.v
21
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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue