Improved tests

This commit is contained in:
2024-03-05 19:10:27 +01:00
parent aae983fd5b
commit 13f4c5fb0f
4 changed files with 19 additions and 12 deletions

View File

@ -24,6 +24,7 @@ func RGB(r Component, g Component, b Component) Color {
func (c Color) Fprint(writer io.Writer, text string) {
if !Terminal {
fmt.Fprint(writer, text)
return
}
fmt.Fprintf(writer, format, byte(c.R*255), byte(c.G*255), byte(c.B*255), text)
@ -33,6 +34,7 @@ func (c Color) Fprint(writer io.Writer, text string) {
func (c Color) Print(text string) {
if !Terminal {
fmt.Print(text)
return
}
fmt.Printf(format, byte(c.R*255), byte(c.G*255), byte(c.B*255), text)
@ -42,6 +44,7 @@ func (c Color) Print(text string) {
func (c Color) Println(text string) {
if !Terminal {
fmt.Println(text)
return
}
fmt.Printf(formatLine, byte(c.R*255), byte(c.G*255), byte(c.B*255), text)