mirror of
https://github.com/RGBCube/color.v
synced 2025-07-31 09:57:47 +00:00
Make not printing color actually work
This commit is contained in:
parent
712324f893
commit
e147a4de42
3 changed files with 12 additions and 8 deletions
|
@ -22,10 +22,6 @@ enum BasicColor {
|
|||
}
|
||||
|
||||
pub fn (c BasicColor) render(msg string) string {
|
||||
if no_color {
|
||||
return msg
|
||||
}
|
||||
|
||||
func := match c {
|
||||
.black { term.black }
|
||||
.red { term.red }
|
||||
|
@ -49,10 +45,6 @@ pub fn (c BasicColor) render(msg string) string {
|
|||
}
|
||||
|
||||
pub fn (c BasicColor) render_bg(msg string) string {
|
||||
if no_color {
|
||||
return msg
|
||||
}
|
||||
|
||||
func := match c {
|
||||
.black { term.bg_black }
|
||||
.red { term.bg_red }
|
||||
|
|
|
@ -3,10 +3,18 @@ module color
|
|||
pub type Color = BasicColor | TrueColor
|
||||
|
||||
pub fn (c Color) render(msg string) string {
|
||||
if no_color {
|
||||
return msg
|
||||
}
|
||||
|
||||
return c.render(msg)
|
||||
}
|
||||
|
||||
pub fn (c Color) render_bg(msg string) string {
|
||||
if no_color {
|
||||
return msg
|
||||
}
|
||||
|
||||
return c.render_bg(msg)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ enum Style {
|
|||
}
|
||||
|
||||
pub fn (s Style) render(msg string) string {
|
||||
if no_color {
|
||||
return msg
|
||||
}
|
||||
|
||||
func := match s {
|
||||
.reset { term.reset }
|
||||
.bold { term.bold }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue