1
Fork 0
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:
RGBCube 2022-12-16 21:44:05 +03:00
parent 6aa8a3fc47
commit 87ab517bea

View file

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