Clean up some inconsistencies in themes.

This commit is contained in:
Jonathan Moore Liles 2020-10-16 19:58:29 -07:00
parent 844e0bcb50
commit d79930a6f5
5 changed files with 64 additions and 50 deletions

View File

@ -91,28 +91,37 @@ static void draw_rectf(int x, int y, int w, int h, Fl_Color bc, double radius =
rect_path( x, y, w, h, radius );
uchar r,g,b;
uchar r,g,b, br,bg,bb;
cairo_color( bc );
Fl::get_color( fl_color(), r, g, b );
Fl::get_color( FL_BACKGROUND_COLOR, br, bg, bb );
float rf = r * BSCALE;
float gf = g * BSCALE;
float bf = b * BSCALE;
float rf = r * BSCALE,
gf = g * BSCALE,
bf = b * BSCALE,
brf = br * BSCALE,
bgf = bg * BSCALE,
bbf = bb * BSCALE;
cairo_pattern_t *grad = 0;
if ( fl_boxes_use_gradients )
{
grad = cairo_pattern_create_linear( x, y, x, y + h );//, 350.0, 350.0);
/* grad = cairo_pattern_create_linear( x, y, x, y + h );//, 350.0, 350.0); */
grad = cairo_pattern_create_linear( x, y, x, y + 5 );//, 350.0, 350.0);
cairo_pattern_add_color_stop_rgb( grad, 0.0, rf, gf, bf );
cairo_pattern_add_color_stop_rgb( grad, 0.4, rf, gf, bf );
cairo_pattern_add_color_stop_rgb( grad, 0.8, rf + 0.1, gf + 0.1, bf + 0.1 );
/* cairo_pattern_add_color_stop_rgb( grad, 0.8, rf + 0.05, gf + 0.05, bf + 0.05 ); */
/* cairo_pattern_add_color_stop_rgb( grad, 0.2, rf + 0.05, gf + 0.05, bf + 0.05 ); */
/* cairo_pattern_add_color_stop_rgb( grad, 0.0, rf + 0.2, gf + 0.2, bf + 0.2 ); */
cairo_set_source( cr, grad );
cairo_pattern_add_color_stop_rgb( grad, 1.0, rf + 0.05, gf + 0.05, bf + 0.05 );
cairo_pattern_add_color_stop_rgb( grad, 0.0, rf + 0.2, gf + 0.2, bf + 0.2 );
cairo_set_source( cr, grad );
}
else
{
@ -122,8 +131,16 @@ static void draw_rectf(int x, int y, int w, int h, Fl_Color bc, double radius =
cairo_fill_preserve (cr);
cairo_set_line_width (cr, DX);
Fl::get_color( fl_color_average( FL_FOREGROUND_COLOR, FL_BACKGROUND_COLOR, 0.1f),
r,g,b);
if ( brf + bgf + bbf > 1.5f )
{
Fl::get_color( fl_color_average( FL_BLACK, fl_color(), 0.5f),
r,g,b);
}
else
{
Fl::get_color( fl_color_average( FL_BLACK, fl_color(), 0.8f),
r,g,b);
}
cairo_set_source_rgba(cr, r*BSCALE,g*BSCALE,b*BSCALE,1);

View File

@ -27,7 +27,7 @@
static void clean_color(Fl_Color c)
{
c = fl_color_average( FL_GRAY, c, 0.2 );
c = fl_color_average( FL_WHITE, c, 0.15f );
if (Fl::draw_box_active())
fl_color(c);
@ -35,6 +35,11 @@ static void clean_color(Fl_Color c)
fl_color(fl_inactive(c));
}
static Fl_Color border_color (Fl_Color c)
{
return fl_color_average( FL_BLACK, FL_BACKGROUND_COLOR,0.70f);
}
static void rect(int x, int y, int w, int h, Fl_Color bc)
{
fl_rect( x, y, w, h, bc );
@ -48,13 +53,13 @@ static void rectf ( int x, int y,int w, int h, Fl_Color bc )
static void up_frame(int x, int y, int w, int h, Fl_Color c)
{
rect(x, y, w, h, fl_color_average( FL_WHITE, c, 0.2 ) );
rect(x, y, w, h, border_color( c ));
}
static void up_box(int x, int y, int w, int h, Fl_Color c)
{
rectf(x, y, w, h, c );
rect(x, y, w, h, fl_color_average( FL_WHITE, c, 0.2 ) );
rect(x, y, w, h, border_color( c ));
}
static void down_frame(int x, int y, int w, int h, Fl_Color c)
@ -68,7 +73,7 @@ static void down_box(int x, int y, int w, int h, Fl_Color c)
FL_BACKGROUND_COLOR == c || FL_BACKGROUND2_COLOR == c
? fl_darker(c)
: c );
rect(x, y, w, h, fl_color_average( FL_WHITE, c, 0.2 ) );
rect(x, y, w, h, border_color( c ));
}
static void flat_box( int x, int y, int w, int h, Fl_Color c )
@ -79,7 +84,7 @@ static void flat_box( int x, int y, int w, int h, Fl_Color c )
static void border_box( int x, int y, int w, int h, Fl_Color c )
{
rectf( x, y, w, h, c );
rect(x, y, w, h, fl_color_average( FL_WHITE, c, 0.2 ) );
rect(x, y, w, h, border_color( c ));
}
static void

View File

@ -275,7 +275,7 @@ shade_round ( int x, int y, int w, int h, const char *c, Fl_Color bc )
static void
up_frame ( int x, int y, int w, int h, Fl_Color c )
{
frame_rect( x, y, w, h - 1, "KLDIIJLM", c );
frame_rect( x, y, w, h - 1, "MLJIIDLK", c );
}
@ -306,8 +306,8 @@ thin_up_box ( int x, int y, int w, int h, Fl_Color c )
{
if ( w > 4 && h > 4 )
{
shade_rect( x + 1, y + 1, w - 2, h - 3, "RQOQSUWQ", c );
frame_rect( x, y, w, h - 1, "IJLM", c );
shade_rect( x + 1, y + 1, w - 2, h - 3, "QWUSQOQR", c );
frame_rect( x, y, w, h - 1, "MLJI", c );
}
else
narrow_thin_box( x, y, w, h, c );
@ -319,7 +319,7 @@ up_box ( int x, int y, int w, int h, Fl_Color c )
{
if ( w > 8 && h > 8 )
{
shade_rect( x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c );
shade_rect( x + 1, y + 1, w - 2, h - 3, "QVWVUTSRQPONQVR", c );
// shade_rect( x + 1, y + 1, w - 2, h - 3, "STUVWVQRWXVUVVQ", c );
// shade_rect( x + 1, y + 1, w - 2, h - 3, "FISPPQQRSSTTUPJ", c );
@ -334,15 +334,15 @@ up_box ( int x, int y, int w, int h, Fl_Color c )
static void
up_round ( int x, int y, int w, int h, Fl_Color c )
{
shade_round( x, y, w, h, "RVQNOPQRSTUVWVQ", c );
frame_round( x, y, w, h, "IJLM", c );
shade_round( x, y, w, h, "QVWVUTSRQPONQVR", c );
frame_round( x, y, w, h, "MLJI", c );
}
static void
down_frame ( int x, int y, int w, int h, Fl_Color c )
{
frame_rect( x, y, w, h - 1, "LLLLTTRR", c );
frame_rect( x, y, w, h - 1, "RRTTLLLL", c );
}
@ -368,8 +368,8 @@ down_box ( int x, int y, int w, int h, Fl_Color c )
static void
down_round ( int x, int y, int w, int h, Fl_Color c )
{
shade_round( x, y, w, h, "STUVWWWVT", c );
frame_round( x, y, w, h, "IJLM", c );
shade_round( x, y, w, h, "TVWWWVUTS", c );
frame_round( x, y, w, h, "MLJI", c );
}
static void

View File

@ -46,30 +46,19 @@ static void frame_rect(int x, int y, int w, int h, Fl_Color bc)
static void shade_rect_up(int x, int y, int w, int h, Fl_Color bc)
{
// Draws the shiny
float third = (float) h / 3;
gleam_color(bc);
fl_rectf(x, y, w, third + 1);
//gleam_color(fl_color_average(bc, FL_WHITE, .90f));
//fl_rectf(x, y, w, half + 1);
float step_size = 0.10 / ((float) h - third);
int j = 0;
//step_size = (.1 / (float) half);
//printf("1 / %i = %f \n", half, (1.0/half));
/**
* This loop generates the nice gradient at the bottom of the
* widget
**/
for (float k = 1; k >= .90; k -= step_size)
{
j++;
gleam_color(fl_color_average(bc, FL_WHITE, k));
fl_line(x, y + j + third - 1, x + w - 1, y + j + third - 1);
}
// Draws the shiny
const float third = 5;
gleam_color(bc);
fl_rectf(x, y, w, third + 1);
const float step_size = 0.10;
float k = 0.5f;
for (int j = 0; j < third; k -= step_size, j++ )
{
gleam_color(fl_color_average( FL_WHITE, bc, k));
fl_line(x, y + j, x + w - 1, y + j);
}
}
static void frame_rect_up(int x, int y, int w, int h, Fl_Color bc)

View File

@ -55,7 +55,10 @@ static Fl_Color border_color ( Fl_Color c )
static Fl_Color interior_color ( Fl_Color c )
{
/* return fl_color_average( FL_BACKGROUND_COLOR, c, 0.33f ); */
return fl_color_average( FL_BACKGROUND_COLOR, c, 0.25f );
/* if ( FL_BACKGROUND_COLOR == c ) */
return fl_color_average( FL_FOREGROUND_COLOR, c, 0.05f );
/* else */
/* return fl_color_average( FL_BACKGROUND_COLOR, c, 0.25f ); */
}
static Fl_Color outer_border_color ( Fl_Color c )