Ghidra is a software reverse engineering (SRE) framework
GP-3592 - Fixed incorrect colors in dark mode
dragonmacher4412fddbea87
diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/pcode/DebuggerPcodeStepperProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/pcode/DebuggerPcodeStepperProvider.javaindex 57e85b7ed1..740487b813 100644--- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/pcode/DebuggerPcodeStepperProvider.java+++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/pcode/DebuggerPcodeStepperProvider.java@@ -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));}diff --git a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/AbstractAddressRangeFilter.java b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/AbstractAddressRangeFilter.javaindex ea095b9100..99b2d93da5 100644--- a/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/AbstractAddressRangeFilter.java+++ b/Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/filters/AbstractAddressRangeFilter.java@@ -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>");diff --git a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/ColorEditor.java b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/ColorEditor.javaindex 7f8ae726cd..55a7648354 100644--- a/Ghidra/Framework/Docking/src/main/java/docking/options/editor/ColorEditor.java+++ b/Ghidra/Framework/Docking/src/main/java/docking/options/editor/ColorEditor.java@@ -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>");diff --git a/Ghidra/Framework/Gui/src/main/java/ghidra/util/WebColors.java b/Ghidra/Framework/Gui/src/main/java/ghidra/util/WebColors.javaindex 2f93bdecab..cb19c04294 100644--- a/Ghidra/Framework/Gui/src/main/java/ghidra/util/WebColors.java+++ b/Ghidra/Framework/Gui/src/main/java/ghidra/util/WebColors.java@@ -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 valuesString[] 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 valuesvalue = value.replaceAll(" ", "");String[] split = value.split(",");if (split.length != 4) {