Improved tests

This commit is contained in:
Eduard Urbach 2024-03-05 19:10:27 +01:00
parent 7db9e36587
commit d5335f4bad
Signed by: eduard
GPG key ID: 49226B848C78F6C8
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)