mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-07 09:59:45 +00:00
color the text in the color wheel's color box such that it's readable no matter the background
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@388 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -66,6 +66,7 @@ typedef struct {
|
|||||||
double value;
|
double value;
|
||||||
unsigned char* color_wheel_image_data;
|
unsigned char* color_wheel_image_data;
|
||||||
unsigned char* color_display_image_data;
|
unsigned char* color_display_image_data;
|
||||||
|
MwPoint point;
|
||||||
} color_wheel;
|
} color_wheel;
|
||||||
|
|
||||||
void color_wheel_wheel_image_update(color_wheel* wheel) {
|
void color_wheel_wheel_image_update(color_wheel* wheel) {
|
||||||
@@ -138,8 +139,17 @@ static void color_wheel_click(MwWidget handle, void* user, void* call) {
|
|||||||
(void)a;
|
(void)a;
|
||||||
|
|
||||||
hexColor = malloc(8);
|
hexColor = malloc(8);
|
||||||
|
char* fgColor = malloc(8);
|
||||||
snprintf(hexColor, 8, "#%02X%02X%02X", r, g, b);
|
snprintf(hexColor, 8, "#%02X%02X%02X", r, g, b);
|
||||||
|
|
||||||
|
int fr = r > 128 ? 0 : 255;
|
||||||
|
int fg = g > 128 ? 0 : 255;
|
||||||
|
int fb = b > 128 ? 0 : 255;
|
||||||
|
|
||||||
|
snprintf(fgColor, 8, "#%02X%02X%02X", fr, fg, fb);
|
||||||
MwSetText(wheel->color_display, MwNbackground, hexColor);
|
MwSetText(wheel->color_display, MwNbackground, hexColor);
|
||||||
|
MwSetText(wheel->color_display_text, MwNforeground, fgColor);
|
||||||
|
|
||||||
MwSetText(wheel->color_display_text, MwNbackground, hexColor);
|
MwSetText(wheel->color_display_text, MwNbackground, hexColor);
|
||||||
MwSetText(wheel->color_display_text, MwNtext, hexColor);
|
MwSetText(wheel->color_display_text, MwNtext, hexColor);
|
||||||
free(hexColor);
|
free(hexColor);
|
||||||
|
|||||||
Reference in New Issue
Block a user