utils: Añadida la función randColor

This commit is contained in:
2023-05-28 11:58:34 +02:00
parent 5d58d24cb9
commit ad9a3fb594
2 changed files with 13 additions and 0 deletions

View File

@@ -602,3 +602,13 @@ color_t lightenColor(color_t color, int amount)
newColor.b = min(255, color.b + amount);
return newColor;
}
// Obtiene un color aleatorio
color_t randColor()
{
color_t newColor;
newColor.r = rand() % 256;
newColor.g = rand() % 256;
newColor.b = rand() % 256;
return newColor;
}

View File

@@ -207,4 +207,7 @@ color_t darkenColor(color_t color, int amount);
// Aclara un color
color_t lightenColor(color_t color, int amount);
// Obtiene un color aleatorio
color_t randColor();
#endif