diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2007-03-20 09:52:51 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2007-03-20 09:52:51 +0000 |
| commit | 27568cfa1c948ba536e03519372b38412adec756 (patch) | |
| tree | e0fee5232c6795a4b0d39585911655b1c62497a7 /src | |
| parent | cae6dd02b26be05961a57339ebbe45146e32044c (diff) | |
Better contrast (#1625)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5748 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_color.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fl_color.cxx b/src/fl_color.cxx index 7ccb14ed4..d39b0d895 100644 --- a/src/fl_color.cxx +++ b/src/fl_color.cxx @@ -374,12 +374,12 @@ Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg) { else c2 = fl_cmap[bg]; // Compute the luminosity... - l1 = ((c1 >> 24) * 31 + ((c1 >> 16) & 255) * 61 + ((c1 >> 8) & 255) * 8) / 100; - l2 = ((c2 >> 24) * 31 + ((c2 >> 16) & 255) * 61 + ((c2 >> 8) & 255) * 8) / 100; + l1 = ((c1 >> 24) * 30 + ((c1 >> 16) & 255) * 59 + ((c1 >> 8) & 255) * 11) / 100; + l2 = ((c2 >> 24) * 30 + ((c2 >> 16) & 255) * 59 + ((c2 >> 8) & 255) * 11) / 100; // Compare and return the contrasting color... - if ((l1 - l2) > 90) return fg; - else if ((l2 - l1) > 90) return fg; + if ((l1 - l2) > 96) return fg; + else if ((l2 - l1) > 96) return fg; else if (l2 > 127) return FL_BLACK; else return FL_WHITE; } |
