-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
karm-gfx: Added a simple helper function for generating colors in hue…
… order. Pretty usefull for debugging
- Loading branch information
1 parent
f904629
commit 91c82c8
Showing
2 changed files
with
27 additions
and
7 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,23 @@ | ||
#include "colors.h" | ||
|
||
namespace Karm::Gfx { | ||
|
||
Color randomColor(Math::Rand &rand) { | ||
return COLORS[rand.nextInt(COLORS.len())]; | ||
} | ||
|
||
Color randomColor() { | ||
static Math::Rand rand{123}; | ||
return randomColor(rand); | ||
} | ||
|
||
Gfx::Color rainbowColor() { | ||
static f64 hue = 0; | ||
auto res = Gfx::hsvToRgb({hue, 1, 1}); | ||
hue += 1; | ||
if (hue > 360) | ||
hue = 0; | ||
return res; | ||
} | ||
|
||
} // namespace Karm::Gfx |
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