Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 278498 - [CSS] CSS support for SWT colour constants
Summary: [CSS] CSS support for SWT colour constants
Status: CLOSED DUPLICATE of bug 402530
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 0.9   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Bogdan Gheorghe CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-29 22:32 EDT by Remy Suen CLA
Modified: 2013-07-04 13:57 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2009-05-29 22:32:29 EDT
Clients may wish to style their colours based on the OS's theme based on what's retrieved via SWT (SWT.COLOR_LIST_FOREGROUND, SWT.COLOR_LIST_BACKGROUND, etc etc). Based on CSS2ColorHelper's colorNamesMap field, I don't think this is currently supported.
Comment 1 Kevin McGuire CLA 2009-06-01 10:12:51 EDT
Agree, this is great idea.
Comment 2 István Mészáros CLA 2013-04-03 09:41:04 EDT
Typical use case is when you want to indicate the validation status on a widget.

Suppose you define a CSS class that changes the text color to red. You add the class to the widget when an invalid value gets entered to it, and remove the CSS class when the widget is cleared/properly filled. The first surprising thing is that when you remove the CSS class the system default text color does not get restored, as you would expect based on your experiences how CSS works in a web browser. After some debugging and code reading you find out that if no matching CSS rules found for a widget it's properties are left alone completely. After this recognition the solution would be, you say, to also define a CSS class for the normal state! Correct. You create your CSS rule and quickly realize that there is nothing you could assign to the color property, if you would like to be platform aware.

Text.valid {
    /* does not work unfortunately */
    background-color: SWT.COLOR_LIST_BACKGROUND;
    color: SWT.COLOR_WIDGET_FOREGROUND;
}


Text.invalid {
    background-color: #f00;
    color: #fff;
}

SWT color constants should be available as e4 specific CSS colors.
Comment 3 Paul Webster CLA 2013-04-03 09:48:28 EDT
See bug 402530 which was recently fixed

PW
Comment 4 István Mészáros CLA 2013-04-03 09:51:18 EDT
Great, thanks.
Comment 5 Lars Vogel CLA 2013-04-04 06:58:04 EDT
Looks to me that this bug is also fixed with Bug 402530? Anything left open here?
Comment 6 Paul Webster CLA 2013-07-04 13:57:33 EDT

*** This bug has been marked as a duplicate of bug 402530 ***