Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 130444

Summary: [Widgets] Link widget has hardcoded color
Product: [Eclipse Project] Platform Reporter: Wassim Melhem <wassim.melhem>
Component: SWTAssignee: Project Inbox <swt-triaged>
Status: CLOSED DUPLICATE QA Contact: Felipe Heidrich <eclipse.felipe>
Severity: normal    
Priority: P3 CC: grendel.b.wulf, hihn, markus.kell.r, peter, prof7bit
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
product editor none

Description Wassim Melhem CLA 2006-03-04 15:35:04 EST
I tried to add an SWT link widget to the product editor because I did not really need FormText in that composite.

I was surprised to see that the SWT link has a different color than hyperlinks in FormText.

Screenshot to follow.
Comment 1 Wassim Melhem CLA 2006-03-04 15:37:10 EST
Created attachment 35729 [details]
product editor

The "product editor" link is a native SWT link.

The hyperlinks in the Testing section are rendered by FormText.
Comment 2 Dejan Glozic CLA 2006-03-04 19:40:08 EST
This is not a bug. 

SWT hyperlink uses WS system colors.

Forms hyperlinks and FormText widget use settings for JFaceColors.getHyperlinkText(Display) and JFaceColors.getActiveHyperlinkText(Display). We are not managing SWT hyperlinks, and they don't know anything about JFaceColors (or JFace for that matter).

I would love to tell you to set the colors yourself, but unfortunately SWT Link widget has chosen to hardcode the RGB for it and does not allow you to change it.

If you need a simple link with a matching color, use UI Form's Hyperlink instead. If you need to mix some static text with links inside it, you can only use FormText.

I recommend moving this defect to SWT to encourage them to expose link color property as API. While they are at it, they can also expose 'hover/active link color' that is applied when the mouse is inside the link.
Comment 3 Wassim Melhem CLA 2006-03-04 22:09:39 EST
adjusting summary and moving to SWT.

The user should be able to set the color of the Link widget.
Comment 4 Felipe Heidrich CLA 2006-03-07 11:28:44 EST
On Windows Xp we use the native link widget (syslink), and it doesn't provide the APIs you asked.
Comment 5 Markus Keller CLA 2007-01-08 10:24:08 EST
See also bug 89827.
Comment 6 Felipe Heidrich CLA 2009-08-20 09:40:01 EDT
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Comment 7 Grendel Wulf CLA 2013-09-06 18:41:08 EDT
(In reply to Felipe Heidrich from comment #4)
> On Windows Xp we use the native link widget (syslink), and it doesn't
> provide the APIs you asked.

Note that in Windows, you can set the link color through system settings. This is a better situation than on GTK (for example), where the color is straight-up hardcoded and cannot be changed.

For reference, the hardcoded value is defined in Link.java like so:

    static final RGB LINK_FOREGROUND = new RGB (0, 51, 153);

And used, later on, like so:

    linkColor = new Color (display, LINK_FOREGROUND);


This situation is rather annoying, when trying to use a dark theme :(
Comment 8 Markus Keller CLA 2013-09-07 12:44:51 EDT
(In reply to Grendel Wulf from comment #7)
> Note that in Windows, you can set the link color through system settings.
> This is a better situation than on GTK (for example), where the color is
> straight-up hardcoded and cannot be changed.

GTK also uses the OS color since 4.3, see bug 181592.

*** This bug has been marked as a duplicate of bug 181592 ***
Comment 9 Bernd K. CLA 2014-04-14 06:09:22 EDT
This bug is not fixed!

I'm using Kepler on Kubuntu and there still exists no way to adjust the hyperlink colors, system settings are ignored.