Ignore:
Timestamp:
2015-12-30T14:18:30+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #12256 - adjust contrast of text displayed in imagery alignment warning, notifications and color preferences. Useful for dark themes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java

    r9078 r9221  
    228228                    return new JLabel();
    229229                if (column == 1) {
    230                     JLabel l = new JLabel(ColorHelper.color2html((Color) o));
    231                     l.setBackground((Color) o);
     230                    Color c = (Color) o;
     231                    JLabel l = new JLabel(ColorHelper.color2html(c));
     232                    l.setBackground(c);
     233                    // http://stackoverflow.com/a/3943023/2257172
     234                    l.setForeground((c.getRed()*0.299 + c.getGreen()*0.587 + c.getBlue()*0.114) > 186 ?
     235                            Color.BLACK : Color.WHITE);
    232236                    l.setOpaque(true);
    233237                    return l;
Note: See TracChangeset for help on using the changeset viewer.