Changeset 9221 in josm


Ignore:
Timestamp:
2015-12-30T14:18:30+01:00 (4 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

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/Notification.java

    r8419 r9221  
    22package org.openstreetmap.josm.gui;
    33
     4import java.awt.Color;
    45import java.awt.Component;
    56
    67import javax.swing.Icon;
     8import javax.swing.JEditorPane;
    79import javax.swing.JOptionPane;
    810import javax.swing.UIManager;
     
    102104        JMultilineLabel lbl = new JMultilineLabel(msg);
    103105        lbl.setMaxWidth(DEFAULT_CONTENT_WIDTH);
     106        lbl.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
     107        lbl.setForeground(Color.BLACK);
    104108        content = lbl;
    105109        return this;
  • trunk/src/org/openstreetmap/josm/gui/layer/AlignImageryPanel.java

    r9135 r9221  
    4545        nagLabel.setLabelFor(detailsList);
    4646        nagLabel.setFont(font);
     47        nagLabel.setForeground(Color.BLACK);
    4748        detailsList.setFont(font);
    4849        final JCheckBox doNotShowAgain = new JCheckBox(tr("Do not show this message again"));
    4950        doNotShowAgain.setOpaque(false);
     51        doNotShowAgain.setForeground(Color.BLACK);
    5052
    5153        JButton closeButton = new JButton(ImageProvider.get("misc", "black_x"));
  • 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.