Skip to main content


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] Tue, 27 July 2010 03:40 Go to next message
KwanKin Yau is currently offline KwanKin YauFriend
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 09:19 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
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 10:34 Go to previous messageGo to next message
KwanKin Yau is currently offline KwanKin YauFriend
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 20:13 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
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] Wed, 28 July 2010 02:11 Go to previous message
KwanKin Yau is currently offline KwanKin YauFriend
Messages: 32
Registered: July 2009
Member
Thanks Sternberg, I see.
Previous Topic:[ANN] RAP 1.4 planning
Next Topic:the view turned into blank
Goto Forum:
  


Current Time: Tue Feb 27 21:38:21 GMT 2024

Powered by FUDForum. Page generated in 0.02389 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top