1
Fork 0
mirror of https://github.com/RGBCube/color.v synced 2025-07-31 09:57:47 +00:00

Remove redundant pub

This commit is contained in:
RGBCube 2022-11-19 19:06:22 +03:00
parent 634607531c
commit 90ef8ab5c6
2 changed files with 10 additions and 10 deletions

View file

@ -21,7 +21,7 @@ enum BasicColor {
bright_white
}
pub fn (c BasicColor) render(msg string) string {
fn (c BasicColor) render(msg string) string {
func := match c {
.black { term.black }
.red { term.red }
@ -44,7 +44,7 @@ pub fn (c BasicColor) render(msg string) string {
return func(msg)
}
pub fn (c BasicColor) render_bg(msg string) string {
fn (c BasicColor) render_bg(msg string) string {
func := match c {
.black { term.bg_black }
.red { term.bg_red }

View file

@ -2,12 +2,6 @@ module color
import term
struct TrueColor {
r int
g int
b int
}
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')
@ -24,10 +18,16 @@ pub fn hex(hex int) !Color {
return rgb(hex >> 16, hex >> 8 & 0xFF, hex & 0xFF)!
}
pub fn (c TrueColor) render(msg string) string {
struct TrueColor {
r int
g int
b int
}
fn (c TrueColor) render(msg string) string {
return term.rgb(c.r, c.g, c.b, msg)
}
pub fn (c TrueColor) render_bg(msg string) string {
fn (c TrueColor) render_bg(msg string) string {
return term.bg_rgb(c.r, c.g, c.b, msg)
}