src/Fl_Button.cxx:

- Fl_Button::draw(): Only use fl_contrast() on the label
      color when value() is non-zero.

src/fl_color.cxx:
    - fl_contrast(): Require at least 1/3 (85) instead of 1/2
      (127) for contrast against the background.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5489 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2006-09-25 16:36:52 +00:00
parent 69dcc7c685
commit faddffcf18
2 changed files with 3 additions and 3 deletions

View File

@ -62,7 +62,7 @@ void Fl_Button::draw() {
if (type() == FL_HIDDEN_BUTTON) return;
Fl_Color col = value() ? selection_color() : color();
draw_box(value() ? (down_box()?down_box():fl_down(box())) : box(), col);
if (labeltype() == FL_NORMAL_LABEL) {
if (labeltype() == FL_NORMAL_LABEL && value()) {
Fl_Color c = labelcolor();
labelcolor(fl_contrast(c, col));
draw_label();

View File

@ -378,8 +378,8 @@ Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg) {
l2 = ((c2 >> 24) * 31 + ((c2 >> 16) & 255) * 61 + ((c2 >> 8) & 255) * 8) / 100;
// Compare and return the contrasting color...
if ((l1 - l2) > 127) return fg;
else if ((l2 - l1) > 127) return fg;
if ((l1 - l2) > 85) return fg;
else if ((l2 - l1) > 85) return fg;
else if (l2 > 127) return FL_BLACK;
else return FL_WHITE;
}