From c8cc2ba6e94f82ec12d12f4764a07231269409f1 Mon Sep 17 00:00:00 2001 From: kin-fuyuki Date: Wed, 18 Feb 2026 04:38:06 -0300 Subject: [PATCH] adding raylib colors inside its own namespace to not conflict with other colors --- examples/Makefile.Web | 2 +- include/raylib.h | 59 +++++++++++++++++++++++-------------------- src/raylib.h | 59 +++++++++++++++++++++++-------------------- 3 files changed, 65 insertions(+), 55 deletions(-) diff --git a/examples/Makefile.Web b/examples/Makefile.Web index f36113f1..c752d3d6 100644 --- a/examples/Makefile.Web +++ b/examples/Makefile.Web @@ -176,7 +176,7 @@ endif # Define default C compiler: CC #------------------------------------------------------------------------------------------------ -CC = gcc +CC = clang ifeq ($(TARGET_PLATFORM),PLATFORM_DESKTOP_GLFW) ifeq ($(PLATFORM_OS),OSX) diff --git a/include/raylib.h b/include/raylib.h index 14eff8c6..551280cc 100644 --- a/include/raylib.h +++ b/include/raylib.h @@ -171,33 +171,8 @@ // Some Basic Colors // NOTE: Custom raylib color palette for amazing visuals on WHITE background -#define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray -#define GRAY CLITERAL(Color){ 130, 130, 130, 255 } // Gray -#define DARKGRAY CLITERAL(Color){ 80, 80, 80, 255 } // Dark Gray -#define YELLOW CLITERAL(Color){ 253, 249, 0, 255 } // Yellow -#define GOLD CLITERAL(Color){ 255, 203, 0, 255 } // Gold -#define ORANGE CLITERAL(Color){ 255, 161, 0, 255 } // Orange -#define PINK CLITERAL(Color){ 255, 109, 194, 255 } // Pink -#define RED CLITERAL(Color){ 230, 41, 55, 255 } // Red -#define MAROON CLITERAL(Color){ 190, 33, 55, 255 } // Maroon -#define GREEN CLITERAL(Color){ 0, 228, 48, 255 } // Green -#define LIME CLITERAL(Color){ 0, 158, 47, 255 } // Lime -#define DARKGREEN CLITERAL(Color){ 0, 117, 44, 255 } // Dark Green -#define SKYBLUE CLITERAL(Color){ 102, 191, 255, 255 } // Sky Blue -#define BLUE CLITERAL(Color){ 0, 121, 241, 255 } // Blue -#define DARKBLUE CLITERAL(Color){ 0, 82, 172, 255 } // Dark Blue -#define PURPLE CLITERAL(Color){ 200, 122, 255, 255 } // Purple -#define VIOLET CLITERAL(Color){ 135, 60, 190, 255 } // Violet -#define DARKPURPLE CLITERAL(Color){ 112, 31, 126, 255 } // Dark Purple -#define BEIGE CLITERAL(Color){ 211, 176, 131, 255 } // Beige -#define BROWN CLITERAL(Color){ 127, 106, 79, 255 } // Brown -#define DARKBROWN CLITERAL(Color){ 76, 63, 47, 255 } // Dark Brown -#define WHITE CLITERAL(Color){ 255, 255, 255, 255 } // White -#define BLACK CLITERAL(Color){ 0, 0, 0, 255 } // Black -#define BLANK CLITERAL(Color){ 0, 0, 0, 0 } // Blank (Transparent) -#define MAGENTA CLITERAL(Color){ 255, 0, 255, 255 } // Magenta -#define RAYWHITE CLITERAL(Color){ 245, 245, 245, 255 } // My own White (raylib logo) + //---------------------------------------------------------------------------------- // Types and Structures Definition @@ -249,7 +224,37 @@ typedef struct Color { unsigned char b; // Color blue value unsigned char a; // Color alpha value } Color; - +#ifndef RAYCOLOR +#define RAYCOLOR +namespace rl { + const Color LIGHTGRAY = (Color){ 200, 200, 200, 255 } ;// Light Gray + const Color GRAY = (Color){ 130, 130, 130, 255 } ;// Gray + const Color DARKGRAY = (Color){ 80, 80, 80, 255 } ;// Dark Gray + const Color YELLOW = (Color){ 253, 249, 0, 255 } ;// Yellow + const Color GOLD = (Color){ 255, 203, 0, 255 } ;// Gold + const Color ORANGE = (Color){ 255, 161, 0, 255 } ;// Orange + const Color PINK = (Color){ 255, 109, 194, 255 } ;// Pink + const Color RED = (Color){ 230, 41, 55, 255 } ;// Red + const Color MAROON = (Color){ 190, 33, 55, 255 } ;// Maroon + const Color GREEN = (Color){ 0, 228, 48, 255 } ;// Green + const Color LIME = (Color){ 0, 158, 47, 255 } ;// Lime + const Color DARKGREEN = (Color){ 0, 117, 44, 255 } ;// Dark Green + const Color SKYBLUE = (Color){ 102, 191, 255, 255 } ;// Sky Blue + const Color BLUE = (Color){ 0, 121, 241, 255 } ;// Blue + const Color DARKBLUE = (Color){ 0, 82, 172, 255 } ;// Dark Blue + const Color PURPLE = (Color){ 200, 122, 255, 255 } ;// Purple + const Color VIOLET = (Color){ 135, 60, 190, 255 } ;// Violet + const Color DARKPURPLE= (Color){ 112, 31, 126, 255 } ;// Dark Purple + const Color BEIGE = (Color){ 211, 176, 131, 255 } ;// Beige + const Color BROWN = (Color){ 127, 106, 79, 255 } ;// Brown + const Color DARKBROWN = (Color){ 76, 63, 47, 255 } ;// Dark Brown + const Color WHITE = (Color){ 255, 255, 255, 255 } ;// White + const Color BLACK = (Color){ 0, 0, 0, 255 } ;// Black + const Color BLANK = (Color){ 0, 0, 0, 0 } ;// Blank (Transparent) + const Color MAGENTA = (Color){ 255, 0, 255, 255 } ;// Magenta + const Color RAYWHITE = (Color){ 245, 245, 245, 255 } ;// My own White (raylib logo) +} +#endif // Rectangle, 4 components typedef struct Rectangle { float x; // Rectangle top-left corner position x diff --git a/src/raylib.h b/src/raylib.h index 14eff8c6..551280cc 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -171,33 +171,8 @@ // Some Basic Colors // NOTE: Custom raylib color palette for amazing visuals on WHITE background -#define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray -#define GRAY CLITERAL(Color){ 130, 130, 130, 255 } // Gray -#define DARKGRAY CLITERAL(Color){ 80, 80, 80, 255 } // Dark Gray -#define YELLOW CLITERAL(Color){ 253, 249, 0, 255 } // Yellow -#define GOLD CLITERAL(Color){ 255, 203, 0, 255 } // Gold -#define ORANGE CLITERAL(Color){ 255, 161, 0, 255 } // Orange -#define PINK CLITERAL(Color){ 255, 109, 194, 255 } // Pink -#define RED CLITERAL(Color){ 230, 41, 55, 255 } // Red -#define MAROON CLITERAL(Color){ 190, 33, 55, 255 } // Maroon -#define GREEN CLITERAL(Color){ 0, 228, 48, 255 } // Green -#define LIME CLITERAL(Color){ 0, 158, 47, 255 } // Lime -#define DARKGREEN CLITERAL(Color){ 0, 117, 44, 255 } // Dark Green -#define SKYBLUE CLITERAL(Color){ 102, 191, 255, 255 } // Sky Blue -#define BLUE CLITERAL(Color){ 0, 121, 241, 255 } // Blue -#define DARKBLUE CLITERAL(Color){ 0, 82, 172, 255 } // Dark Blue -#define PURPLE CLITERAL(Color){ 200, 122, 255, 255 } // Purple -#define VIOLET CLITERAL(Color){ 135, 60, 190, 255 } // Violet -#define DARKPURPLE CLITERAL(Color){ 112, 31, 126, 255 } // Dark Purple -#define BEIGE CLITERAL(Color){ 211, 176, 131, 255 } // Beige -#define BROWN CLITERAL(Color){ 127, 106, 79, 255 } // Brown -#define DARKBROWN CLITERAL(Color){ 76, 63, 47, 255 } // Dark Brown -#define WHITE CLITERAL(Color){ 255, 255, 255, 255 } // White -#define BLACK CLITERAL(Color){ 0, 0, 0, 255 } // Black -#define BLANK CLITERAL(Color){ 0, 0, 0, 0 } // Blank (Transparent) -#define MAGENTA CLITERAL(Color){ 255, 0, 255, 255 } // Magenta -#define RAYWHITE CLITERAL(Color){ 245, 245, 245, 255 } // My own White (raylib logo) + //---------------------------------------------------------------------------------- // Types and Structures Definition @@ -249,7 +224,37 @@ typedef struct Color { unsigned char b; // Color blue value unsigned char a; // Color alpha value } Color; - +#ifndef RAYCOLOR +#define RAYCOLOR +namespace rl { + const Color LIGHTGRAY = (Color){ 200, 200, 200, 255 } ;// Light Gray + const Color GRAY = (Color){ 130, 130, 130, 255 } ;// Gray + const Color DARKGRAY = (Color){ 80, 80, 80, 255 } ;// Dark Gray + const Color YELLOW = (Color){ 253, 249, 0, 255 } ;// Yellow + const Color GOLD = (Color){ 255, 203, 0, 255 } ;// Gold + const Color ORANGE = (Color){ 255, 161, 0, 255 } ;// Orange + const Color PINK = (Color){ 255, 109, 194, 255 } ;// Pink + const Color RED = (Color){ 230, 41, 55, 255 } ;// Red + const Color MAROON = (Color){ 190, 33, 55, 255 } ;// Maroon + const Color GREEN = (Color){ 0, 228, 48, 255 } ;// Green + const Color LIME = (Color){ 0, 158, 47, 255 } ;// Lime + const Color DARKGREEN = (Color){ 0, 117, 44, 255 } ;// Dark Green + const Color SKYBLUE = (Color){ 102, 191, 255, 255 } ;// Sky Blue + const Color BLUE = (Color){ 0, 121, 241, 255 } ;// Blue + const Color DARKBLUE = (Color){ 0, 82, 172, 255 } ;// Dark Blue + const Color PURPLE = (Color){ 200, 122, 255, 255 } ;// Purple + const Color VIOLET = (Color){ 135, 60, 190, 255 } ;// Violet + const Color DARKPURPLE= (Color){ 112, 31, 126, 255 } ;// Dark Purple + const Color BEIGE = (Color){ 211, 176, 131, 255 } ;// Beige + const Color BROWN = (Color){ 127, 106, 79, 255 } ;// Brown + const Color DARKBROWN = (Color){ 76, 63, 47, 255 } ;// Dark Brown + const Color WHITE = (Color){ 255, 255, 255, 255 } ;// White + const Color BLACK = (Color){ 0, 0, 0, 255 } ;// Black + const Color BLANK = (Color){ 0, 0, 0, 0 } ;// Blank (Transparent) + const Color MAGENTA = (Color){ 255, 0, 255, 255 } ;// Magenta + const Color RAYWHITE = (Color){ 245, 245, 245, 255 } ;// My own White (raylib logo) +} +#endif // Rectangle, 4 components typedef struct Rectangle { float x; // Rectangle top-left corner position x