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

Remove redundant methods and adjust spacing

This commit is contained in:
RGBCube 2022-11-18 20:44:16 +03:00
parent 06d6948a2d
commit ed70f4a236
4 changed files with 2 additions and 28 deletions

View file

@ -1,29 +1,3 @@
module color
pub type Color = BasicColor | TrueColor
// I have no idea why these are needed
fn (c Color) render(msg string) string {
return c.render(msg)
}
fn (c Color) render_bg(msg string) string {
return c.render_bg(msg)
}
fn (c Color) cprint(msg string) string {
return c.cprint(msg)
}
fn (c Color) cprintln(msg string) string {
return c.cprintln(msg)
}
fn (c Color) cprintln_bg(msg string) string {
return c.cprintln_bg(msg)
}
fn (c Color) cprint_bg(msg string) string {
return c.cprint_bg(msg)
}

View file

@ -20,7 +20,6 @@ pub fn (p &PaintBrush) render(msg string) string {
if bg := p.bg {
result = bg.render(result)
}
for style in p.styles {
result = style.render(result)
}

View file

@ -28,6 +28,7 @@ pub fn (s Style) render(msg string) string {
.hidden { term.hidden }
.strikethrough { term.strikethrough }
}
return func(msg)
}

View file

@ -13,6 +13,7 @@ pub fn rgb(r int, g int, b int) !Color {
if r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255 {
return error('Red, green and blue must each be between 0 and 255')
}
return TrueColor{
r: r
g: g
@ -24,7 +25,6 @@ pub fn hex(hex int) !Color {
return rgb(hex >> 16, hex >> 8 & 0xFF, hex & 0xFF)!
}
pub fn (c TrueColor) render(msg string) string {
return term.rgb(c.r, c.g, c.b, msg)
}