GP-3592 - Fixed incorrect colors in dark mode

This commit is contained in:
dragonmacher 2023-07-21 17:12:03 -04:00
parent 07b664bbbf
commit 4412fddbea
4 changed files with 12 additions and 6 deletions

View File

@ -310,7 +310,7 @@ public class DebuggerPcodeStepperProvider extends ComponentProviderAdapter {
}
protected static String htmlColor(Color color, String display) {
return String.format("<font color=\"%s\">%s</font>", WebColors.toString(color),
return String.format("<font color=\"%s\">%s</font>", WebColors.toString(color, false),
HTMLUtilities.escapeHTML(display));
}

View File

@ -123,7 +123,7 @@ public abstract class AbstractAddressRangeFilter<T> extends AncillaryFilter<T>
//
// Lower Score Panel
//
String fgColor = WebColors.toString(FG_TOOLTIP_DEFAULT);
String fgColor = WebColors.toString(FG_TOOLTIP_DEFAULT, false);
lowerRangePanel = new JPanel(new GridLayout(2, 1));
JLabel lowLabel =
new GHtmlLabel("<html><font size=\"2\" color=\"" + fgColor + "\">low</font>");

View File

@ -88,7 +88,8 @@ public class ColorEditor extends PropertyEditorSupport {
private void updateColor(Color newColor) {
// change the color to a darker value if the color being set is light
String colorString = WebColors.toString(ColorUtils.contrastForegroundColor(newColor));
String colorString =
WebColors.toString(ColorUtils.contrastForegroundColor(newColor), false);
previewLabel.setText(
"<HTML><CENTER><I><FONT SIZE=2 COLOR=" + colorString + ">click</FONT></I></CENTER>");

View File

@ -23,6 +23,11 @@ import java.util.Map;
* Class for web color support. This class defines many of the colors used by html. This class
* includes methods for converting a color to a string (name or hex value) and for converting
* those strings back to a color.
* <p>
* Usage Note: Java's HTML rendering engine supports colors in hex form ('#aabb11'). Also, the
* engine supports many web color names ('silver'). However, not all web color names defined in
* this file are supported. Thus, when specifying HTML colors, do not rely on these web color
* names.
*/
public abstract class WebColors {
private static final Map<String, Color> nameToColorMap = new HashMap<>();
@ -229,7 +234,7 @@ public abstract class WebColors {
}
/**
* Returns the hex value string for the given color
* Returns the hex value string for the given color
* @param color the color
* @return the string
*/
@ -382,7 +387,7 @@ public abstract class WebColors {
value = value.substring(4, value.length() - 1);
}
// strip off to comma separated values
// strip off to comma separated values
String[] split = value.split(",");
if (split.length != 3) {
return null;
@ -404,7 +409,7 @@ public abstract class WebColors {
value = value.substring(5, value.length() - 1);
}
// strip off to comma separated values
// strip off to comma separated values
value = value.replaceAll(" ", "");
String[] split = value.split(",");
if (split.length != 4) {