-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package render | ||
|
||
import ( | ||
"image/color" | ||
|
||
"github.com/faiface/pixel" | ||
) | ||
|
||
func GetColor(r, g, b int) color.Color { | ||
if r == 0 && g == 0 && b == 0 { | ||
return pixel.RGB(1, 1, 1) | ||
} | ||
return pixel.RGB(float64(r)/255, float64(g)/255, float64(b)/255) | ||
} | ||
|
||
func ColorWhite() color.Color { | ||
return GetColor(255, 255, 255) | ||
} | ||
|
||
func ColorRed() color.Color { | ||
return GetColor(255, 0, 0) | ||
} | ||
|
||
func ColorYellow() color.Color { | ||
return GetColor(255, 255, 0) | ||
} | ||
|
||
func ColorGreen() color.Color { | ||
return GetColor(0, 255, 0) | ||
} | ||
|
||
func ColorBlue() color.Color { | ||
return GetColor(0, 0, 255) | ||
} | ||
|
||
func ColorPurple() color.Color { | ||
return GetColor(255, 0, 255) | ||
} | ||
|
||
func ColorCyan() color.Color { | ||
return GetColor(1, 255, 255) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters