From cf8af1902c556ef4c0a355beb9af4fe99691672a Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Thu, 2 Sep 2010 00:39:43 +0000 Subject: [PATCH] In /rgb 3 mode: If skin colors are compatible with /rgb 3, they are the ideal colors for matching, and those you add when loading low-color images or typing 'Backspace' in Palette. Otherwise the ideal color set is hard-coded black/dark_blue/grey/white git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1603 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/palette.c | 20 +++++++++++++++++--- src/windows.c | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/palette.c b/src/palette.c index 125be3cd..00542934 100644 --- a/src/palette.c +++ b/src/palette.c @@ -2844,14 +2844,28 @@ const T_Components * Favorite_GUI_color(byte color_index) { static const T_Components cpc_colors[4] = { { 0, 0, 0}, + { 0, 0,128}, // Dark blue {128,128,128}, // Grey - { 0,255,128}, // Soft light green {255,255,255} }; if (RGB_scale==3) - // Specialized colors for CPC palette - return &cpc_colors[color_index]; + { + // Check if ALL GUI colors are compatible with /rgb 3 + int i; + for (i=0; i<4; i++) + { + T_Components col; + col=Gfx->Default_palette[Gfx->Color[i]]; + if ((col.R!=255 && col.R!=128 && col.R!=0) + ||(col.G!=255 && col.G!=128 && col.G!=0) + ||(col.B!=255 && col.B!=128 && col.B!=0)) + // Specialized colors for CPC palette + return &cpc_colors[color_index]; + } + // Skin has suitable colors + return &(Gfx->Default_palette[Gfx->Color[color_index]]); + } else // Should be Config.Fav_menu_colors[index] if using user colors return &(Gfx->Default_palette[Gfx->Color[color_index]]); diff --git a/src/windows.c b/src/windows.c index abd82669..4254f54a 100644 --- a/src/windows.c +++ b/src/windows.c @@ -2762,8 +2762,8 @@ void Compute_optimal_menu_colors(T_Components * palette) const int tolerence=16; const T_Components cpc_colors[4] = { { 0, 0, 0}, + { 0, 0,128}, // Dark blue {128,128,128}, // Grey - { 0,255,128}, // Soft light green {255,255,255} };