Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Where is common used Color symbolic name defined?
Where is common used Color symbolic name defined? [message #549519] Mon, 26 July 2010 23:40 Go to next message
KwanKin Yau is currently offline KwanKin Yau
Messages: 32
Registered: July 2009
Member
Hi,
I want use some Color in different situation. For example, I want use GRAY_TEXT_COLOR for disabled text foreground, NORMAL_TEXT for enabled. But I dont known which class defines these constants. If there is such class, the other question is: Can theses constant work with theme?

Thanks.
Re: Where is common used Color symbolic name defined? [message #549579 is a reply to message #549519] Tue, 27 July 2010 05:19 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1151
Registered: July 2009
Senior Member

Hi Yau,

You should use the theming [1] for this kind of setting. For example,
you can set the normal and gray text color for a Text field like this:

Text {
color: black;
}

Text:disabled {
color: #cecece;
}

You can get the default text color by calling display.getSystemColor(
SWT.COLOR_WIDGET_FOREGROUND ), but there is no such constant for
disabled text.

HTH, Ralf


Yau wrote:
> Hi, I want use some Color in different situation. For example, I want
> use GRAY_TEXT_COLOR for disabled text foreground, NORMAL_TEXT for
> enabled. But I dont known which class defines these constants. If there
> is such class, the other question is: Can theses constant work with theme?
>
> Thanks.
Re: Where is common used Color symbolic name defined? [message #549595 is a reply to message #549579] Tue, 27 July 2010 06:34 Go to previous messageGo to next message
KwanKin Yau is currently offline KwanKin Yau
Messages: 32
Registered: July 2009
Member
Thanks, for example, I have an LabelProvider and override the method

public Color getForeground(Object element) {
if (the element is disabled)
return the disabled-text-color;
else
return the default-text-color;
}

So, how can I get the color definition or color description(which has the disabled symantic) from the current using theme?
Re: Where is common used Color symbolic name defined? [message #549756 is a reply to message #549595] Tue, 27 July 2010 16:13 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1151
Registered: July 2009
Senior Member

Hi Yau,

as I said, there is no API - neither in SWT nor in RAP - to get the
disabled text color from the theme. I'd suggest that you define your own
RGB constant and keep it in sync with your theme.

Would this be an option?

Regards, Ralf

Yau wrote:
> Thanks, for example, I have an LabelProvider and override the method
>
> public Color getForeground(Object element) {
> if (the element is disabled)
> return the disabled-text-color;
> else
> return the default-text-color;
> }
>
> So, how can I get the color definition or color description(which has
> the disabled symantic) from the current using theme?


--
Ralf Sternberg

Need professional support for RAP and RCP?
http://www.eclipsesource.com/support/

Twitter: @eclipsesource
Blog: http://www.eclipsesource.com/blogs/
Re: Where is common used Color symbolic name defined? [message #549802 is a reply to message #549756] Tue, 27 July 2010 22:11 Go to previous message
KwanKin Yau is currently offline KwanKin Yau
Messages: 32
Registered: July 2009
Member
Thanks Sternberg, I see.
Previous Topic:Custom Control
Next Topic:Accessing a RAP application without a servlet name
Goto Forum:
  


Current Time: Thu May 23 06:59:55 EDT 2013

Powered by FUDForum. Page generated in 0.01635 seconds