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 | |
| parent | cae6dd02b26be05961a57339ebbe45146e32044c (diff) | |
Better contrast (#1625)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5748 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | CHANGES | 3 | ||||
| -rw-r--r-- | src/fl_color.cxx | 8 |
2 files changed, 7 insertions, 4 deletions
@@ -4,6 +4,9 @@ CHANGES IN FLTK 1.1.8 STR #1457, STR #1458, STR #1460, STR #1481, STR #1578) - The sample RPM spec file now enables large file support and threading support (STR #1603) + - Changed minumu contrast between background and text to + 96 and added more weight to the blue component to improve + readability (STR #1625) - Fixed VCNet OpenGL project file (STR #1617) - Fixed scrolling of clipped areas in MSWindows (STR #1601) 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; } |
