diff --git a/kernel/inc/drivers/graphics/color.h b/kernel/inc/drivers/graphics/color.h index fa2dc58..b112664 100644 --- a/kernel/inc/drivers/graphics/color.h +++ b/kernel/inc/drivers/graphics/color.h @@ -18,6 +18,21 @@ #include "utils/stdtypes.h" +// Colors from https://gogh-co.github.io/Gogh/ +typedef enum { + COLOR_PAL_GREY_DARK, + COLOR_PAL_PINK, + COLOR_PAL_GREEN_SIGNAL, + COLOR_PAL_ORANGE, + COLOR_PAL_BLUE, + COLOR_PAL_PURPLE, + COLOR_PAL_GREEN, + COLOR_PAL_GREY_LIGHT, + COLOR_PAL_RED, + + COLOR_PAL_ENUM_END +} color_palette_E; + typedef struct { uint8_t alpha; uint8_t red; @@ -25,6 +40,8 @@ typedef struct { uint8_t blue; } color_argb_T; +extern color_argb_T color_palette[COLOR_PAL_ENUM_END]; + color_argb_T color_argb_blend_alpha(color_argb_T background, color_argb_T foreground); #endif //NOX_COLOR_H diff --git a/kernel/src/drivers/graphics/color.c b/kernel/src/drivers/graphics/color.c index aea3644..0ef3654 100644 --- a/kernel/src/drivers/graphics/color.c +++ b/kernel/src/drivers/graphics/color.c @@ -15,11 +15,23 @@ #include "drivers/graphics/color.h" +color_argb_T color_palette[COLOR_PAL_ENUM_END] = { + {0xFF, 0x36, 0x36, 0x36}, // GREY_DARK + {0xFF, 0xFF, 0x08, 0x83}, // PINK + {0xFF, 0x83, 0xff, 0x08}, // GREEN_SIGNAL + {0xFF, 0xFF, 0x83, 0x08}, // ORANGE + {0xFF, 0x08, 0x83, 0xFF}, // BLUE + {0xFF, 0x83, 0x08, 0xFF}, // PURPLE + {0xFF, 0x08, 0xFF, 0x83}, // GREEN + {0xFF, 0xB6, 0xB6, 0xB6}, // GREY_LIGHT + {0xFF, 0xFF, 0x00, 0x00}, // RED +}; + color_argb_T color_argb_blend_alpha(color_argb_T background, color_argb_T foreground) { - color_argb_T color = foreground; - color.red += ((foreground.red * foreground.alpha) + (background.red * (0xFF - foreground.alpha))) / 0xFF; - color.green += ((foreground.green * foreground.alpha) + (background.green * (0xFF - foreground.alpha))) / 0xFF; - color.blue += ((foreground.blue * foreground.alpha) + (background.blue * (0xFF - foreground.alpha))) / 0xFF; + color_argb_T color; + color.red = ((foreground.red * foreground.alpha) + (background.red * (0xFF - foreground.alpha))) / 0xFF; + color.green = ((foreground.green * foreground.alpha) + (background.green * (0xFF - foreground.alpha))) / 0xFF; + color.blue = ((foreground.blue * foreground.alpha) + (background.blue * (0xFF - foreground.alpha))) / 0xFF; return color; }