Skip to content

Commit

Permalink
Interactive Find_Orb does a slightly better job of picking out colors…
Browse files Browse the repository at this point in the history
… on 256-color xterm displays
  • Loading branch information
Bill-Gray committed Apr 19, 2023
1 parent 115c730 commit 5f4f574
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions findorb.cpp
Expand Up @@ -2853,11 +2853,17 @@ static int find_rgb( const int irgb)
| (rgb0[2] > 127 ? 4 : 0));
if( COLORS >= 256)
{
const int r_idx = (rgb0[0] + 10) / 50;
const int g_idx = (rgb0[1] + 10) / 50;
const int b_idx = (rgb0[2] + 10) / 50;
if( rgb0[0] == rgb0[1] && rgb0[0] == rgb0[2] /* gray-scale */
&& rgb0[0] > 4 && rgb0[0] < 247)
return( 232 + (rgb0[0] - 4) / 10);
else
{
const int r_idx = (rgb0[0] + 10) / 50;
const int g_idx = (rgb0[1] + 10) / 50;
const int b_idx = (rgb0[2] + 10) / 50;

return( 16 + b_idx + 6 * g_idx + 36 * r_idx);
return( 16 + b_idx + 6 * g_idx + 36 * r_idx);
}
}
for( i = 0; i < 3; i++)
rgb0[i] = rgb0[i] * 200 / 51;
Expand Down

0 comments on commit 5f4f574

Please sign in to comment.