Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2019-06-28 03:08:22 -0400
committerLakshmi Priya Shanmugam2019-07-01 02:40:50 -0400
commit39eec9ce0c110e5b7b0560c372ebb0f6bea4e83b (patch)
treef06d7ac276abe4829f2c9a70eb51bcfce1e65637
parent7da8f5c6d27006f4aa4ebb13b53181e186da9790 (diff)
downloadeclipse.platform.swt-39eec9ce0c110e5b7b0560c372ebb0f6bea4e83b.tar.gz
eclipse.platform.swt-39eec9ce0c110e5b7b0560c372ebb0f6bea4e83b.tar.xz
eclipse.platform.swt-39eec9ce0c110e5b7b0560c372ebb0f6bea4e83b.zip
Bug 547030: [macOS] StyledText link color is wrong in dark mojave mode
Use the same color as SWT.COLOR_LINK_FOREGROUND. Don't use the constant directly here, we don't want to refer to widgets package from graphics package. Change-Id: I0bb0abe8ffd172783f573b09b59b74dd40be7c6b
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java
index 4f8f4f7140..d61d25519d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/TextLayout.java
@@ -54,6 +54,7 @@ public final class TextLayout extends Resource {
int wrapWidth;
int orientation;
private double defaultTabWidth;
+ NSColor linkForeground;
int[] lineOffsets;
NSRect[] lineBounds;
@@ -64,7 +65,6 @@ public final class TextLayout extends Resource {
static final int TAB_COUNT = 32;
static final int UNDERLINE_THICK = 1 << 16;
- static final RGB LINK_FOREGROUND = new RGB (0, 51, 153);
int[] invalidOffsets;
private boolean ignoreSegments;
static final char LTR_MARK = '\u200E', RTL_MARK = '\u200F';
@@ -267,7 +267,7 @@ void computeRuns() {
case SWT.UNDERLINE_LINK: {
underlineStyle = OS.NSUnderlineStyleSingle;
if (foreground == null) {
- NSColor color = NSColor.colorWithDeviceRed(LINK_FOREGROUND.red / 255f, LINK_FOREGROUND.green / 255f, LINK_FOREGROUND.blue / 255f, 1);
+ NSColor color = getLinkColor();
attrStr.addAttribute(OS.NSForegroundColorAttributeName, color, range);
}
break;
@@ -1059,6 +1059,20 @@ public FontMetrics getLineMetrics (int lineIndex) {
}
}
+NSColor getLinkColor() {
+ if (linkForeground == null) {
+ /**
+ * Color used is same as SWT.COLOR_LINK_FOREGROUND computed in Display.getWidgetColorRGB()
+ */
+ NSTextView textView = (NSTextView)new NSTextView().alloc();
+ textView.init ();
+ NSDictionary dict = textView.linkTextAttributes();
+ linkForeground = new NSColor(dict.valueForKey(OS.NSForegroundColorAttributeName));
+ textView.release ();
+ }
+ return linkForeground;
+}
+
/**
* Returns the location for the specified character offset. The
* <code>trailing</code> argument indicates whether the offset

Back to the top