FLTK logo

Re: [fltk/fltk] The FLTK colormap differs between the Windows platform and other platforms (Issue #969)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] The FLTK colormap differs between the Windows platform and other platforms (Issue #969) ManoloFLTK 22:52 May 06  
 

Here is the code in function Fl_Menu_Item::draw() of src/Fl_Menu.cxx that sets the text and background colors to draw menu items. This code uses fl_contrast() twice which, I believe, is ultimately too much.

 if (fl_contrast(r, color) != r) { // back compatibility boxtypes
     if (selected == 2) { // menu title
       r = color;
       b = m ? m->box() : FL_UP_BOX;
     } else {
       r = (Fl_Color)(FL_COLOR_CUBE-1); // white
       l.color = fl_contrast((Fl_Color)labelcolor_, r);
     }
   } else {
     l.color = fl_contrast((Fl_Color)labelcolor_, r);
   }

Replacing this by just
l.color = fl_contrast((Fl_Color)labelcolor_, r);
fixes the issue of Windows menu items, keeps the lighter selection hue used in Windows, and makes sure the text is drawn with enough contrast relatively to its background with a single fl_contrast() call.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/issues/969/2097501133@github.com>

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.