Bug 434309 - [CSS] Tree/Table selection color should be customizable
Summary: [CSS] Tree/Table selection color should be customizable
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC All
: P3 enhancement with 3 votes (vote)
Target Milestone: 4.5 M7   Edit
Assignee: Fabio Zadrozny CLA
QA Contact: Lars Vogel CLA
URL:
Whiteboard:
Keywords: greatfix
: 436336 (view as bug list)
Depends on:
Blocks: 562330 562781
  Show dependency tree
 
Reported: 2014-05-07 06:58 EDT by Fabio Zadrozny CLA
Modified: 2020-08-22 06:39 EDT (History)
10 users (show)

See Also:


Attachments
Screenshot showing changes (61.07 KB, image/png)
2015-04-09 09:53 EDT, Fabio Zadrozny CLA
no flags Details
Screenshot showing how it was before (78.76 KB, image/png)
2015-04-09 12:06 EDT, Fabio Zadrozny CLA
no flags Details
Screenshot (124.96 KB, image/png)
2015-04-09 13:14 EDT, Lars Vogel CLA
no flags Details
Theme on Windows with latest patch applied. (90.85 KB, image/png)
2015-04-15 21:55 EDT, Fabio Zadrozny CLA
no flags Details
Theme on Windows before having the latest patch applied. (87.38 KB, image/png)
2015-04-15 21:56 EDT, Fabio Zadrozny CLA
no flags Details
red table selection background with patch set 6 (10.07 KB, image/png)
2015-04-19 06:55 EDT, Dirk Fauth CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Zadrozny CLA 2014-05-07 06:58:22 EDT
The tree/table selection color should have a proper API to customizing it. Currently, this is possible with a custom painter but given that it's possible to customize the background and foreground through simple APIs that's almost worthless if the selection color can't be changed (and changing it with a custom painter although doable is quite cumbersome and error-prone).
Comment 1 Fabio Zadrozny CLA 2015-04-09 09:36:24 EDT
Changing request to have a way to customize it in the CSS at least through a custom painter).
Comment 2 Eclipse Genie CLA 2015-04-09 09:51:05 EDT
New Gerrit change created: https://git.eclipse.org/r/45555
Comment 3 Fabio Zadrozny CLA 2015-04-09 09:53:09 EDT
Created attachment 252261 [details]
Screenshot showing changes

Showing screenshot of the UI with the changes from Gerrit applied.
Comment 4 Fabio Zadrozny CLA 2015-04-09 10:17:33 EDT
Note: this should probably be assigned to Platform-UI now.
Comment 5 Lars Vogel CLA 2015-04-09 11:28:25 EDT
Can you add a before and after screen shot from the Eclipse IDE?
Comment 6 Fabio Zadrozny CLA 2015-04-09 12:06:30 EDT
Created attachment 252269 [details]
Screenshot showing how it was before

Adding screenshot on how it was before (the other attachment shows the after).
Comment 7 Leo Ufimtsev CLA 2015-04-09 12:29:33 EDT
Looks like Platform UI? Please assign back if this is an error on my side.
Comment 8 Lars Vogel CLA 2015-04-09 13:14:44 EDT
Created attachment 252271 [details]
Screenshot

Good that be extended to Linux? Under Linux the selection color also look weird, see screenshot.
Comment 9 Fabio Zadrozny CLA 2015-04-09 13:24:35 EDT
Yes, I think that it can be used in Linux and even Mac too (I do that on LiClipse).

-- i.e.: I haven't tested it here, but it should work out of the box. I've just amended the Gerrit change to add support for Linux. Can you check that locally to see how that appears for you? (if there's something strange I'll see how to setup the SDK env for Linux on a vm here, but that may take more time).
Comment 10 Lars Vogel CLA 2015-04-09 13:48:32 EDT
(In reply to Fabio Zadrozny from comment #9)

.: I haven't tested it here, but it should work out of the box. I've
> just amended the Gerrit change to add support for Linux. Can you check that
> locally to see how that appears for you? (if there's something strange I'll
> see how to setup the SDK env for Linux on a vm here, but that may take more
> time).

I think the change was in the wrong css file, but if move it to the e4-dark.css the painter overrides the text in the Task list once I select a line.
Comment 11 Fabio Zadrozny CLA 2015-04-09 13:52:08 EDT
Actually, you're right, I've put it in the wrong place... will fix that.
Comment 12 Lars Vogel CLA 2015-04-10 10:21:41 EDT
(In reply to Fabio Zadrozny from comment #11)
> Actually, you're right, I've put it in the wrong place... will fix that.

AFAICS you last change only moves the CSS to the correct file, I did this already in my test and under linux the painter overrides the text in the Task list once I select a line. The line becomes unreadable.
Comment 13 Fabio Zadrozny CLA 2015-04-15 21:55:53 EDT
Created attachment 252441 [details]
Theme on Windows with latest patch applied.
Comment 14 Fabio Zadrozny CLA 2015-04-15 21:56:40 EDT
Created attachment 252442 [details]
Theme on Windows before having the latest patch applied.
Comment 15 Fabio Zadrozny CLA 2015-04-15 21:59:36 EDT
(In reply to Lars Vogel from comment #12)
> (In reply to Fabio Zadrozny from comment #11)
> > Actually, you're right, I've put it in the wrong place... will fix that.
> 
> AFAICS you last change only moves the CSS to the correct file, I did this
> already in my test and under linux the painter overrides the text in the
> Task list once I select a line. The line becomes unreadable.

In the end, I wasn't able to make it work with the current 4.5 on Linux (added more details on Gerrit), so, making it windows-only again (at least for now).
Comment 16 Dani Megert CLA 2015-04-16 05:04:12 EDT
This change will have to wait until 4.6, since we are past the API freeze. This will also give you time to make sure it works on all platforms.
Comment 17 Fabio Zadrozny CLA 2015-04-16 06:38:06 EDT
Hi Dani,

Lars mentioned previously (at https://bugs.eclipse.org/bugs/show_bug.cgi?id=434201#c23) that The CSS engine is not API, so PMC approval is not required for this change (and thus something like that could still enter at this point -- at least https://bugs.eclipse.org/bugs/show_bug.cgi?id=434201 entered this way in this same structure).

Regarding other platforms, windows is probably the worse in this regard (so, it really needs the patch more than others) -- also, the whole UI is very platform dependent, so, I see no issue in getting it in just for windows (i.e.: the patch doesn't really need to support other platforms right now).

The API changes are all in the css API (TreeElement, TableElement -- others are in internal packages and should not be considered part of the public API anyways).
Comment 18 Dani Megert CLA 2015-04-16 09:55:54 EDT
(In reply to Fabio Zadrozny from comment #17)
> Hi Dani,
> 
> Lars mentioned previously (at
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=434201#c23) that The CSS
> engine is not API, so PMC approval is not required for this change 

I only looked at the package names which indicate API. But those packages are not declared API in the manifest.
Comment 19 Dirk Fauth CLA 2015-04-19 06:55:34 EDT
Created attachment 252515 [details]
red table selection background with patch set 6

I first tested patch set 6 with the dark theme. There it looks good as far as I can tell.

Then I tested the patch by only setting the selection background to red via CSS without additional settings like this:

Table {
	swt-selection-foreground-color: white;
	swt-selection-background-color: red;
}

As you can see in the 'red table selection background' attachment, it doesn't look correct there. What am I missing? It looks like there is an overlay on top of the styling. How can this be disabled?

And what is the swt-hot-background-color attribute for? I didn't noticed any changes when setting a value for this.
Comment 20 Fabio Zadrozny CLA 2015-04-19 20:33:36 EDT
(In reply to Dirk Fauth from comment #19)
> Created attachment 252515 [details]
> red table selection background with patch set 6
> 
> I first tested patch set 6 with the dark theme. There it looks good as far
> as I can tell.
> 
> Then I tested the patch by only setting the selection background to red via
> CSS without additional settings like this:
> 
> Table {
> 	swt-selection-foreground-color: white;
> 	swt-selection-background-color: red;
> }
> 
> As you can see in the 'red table selection background' attachment, it
> doesn't look correct there. What am I missing? It looks like there is an
> overlay on top of the styling. How can this be disabled?
> 
> And what is the swt-hot-background-color attribute for? I didn't noticed any
> changes when setting a value for this.

Hi Dirk,

Thanks for checking it (and finding an issue I hadn't found before).

There really was an issue when there was a Table with the 'MULTI' selection style (and several cells were selected) -- I've just fixed that and submitted a new patch.
Comment 22 Lars Vogel CLA 2015-04-20 16:18:10 EDT
Thanks Fabio.
Comment 23 Lars Vogel CLA 2015-04-28 15:02:27 EDT
Dirk, can you test the latest build under windows?
Comment 24 Dirk Fauth CLA 2015-04-28 15:43:19 EDT
Tested with Eclipse 4.5.0 Integration Build: I20150428-0100 and it looks good.
Comment 25 Lars Vogel CLA 2015-05-05 06:05:47 EDT
*** Bug 436336 has been marked as a duplicate of this bug. ***
Comment 26 Lars Vogel CLA 2016-09-15 03:34:26 EDT
Fabio, I noticed that you did not update the CSS wiki? Can you add this styling information to it? https://wiki.eclipse.org/E4/CSS/SWT_Mapping
Comment 27 Andrew Obuchowicz CLA 2020-06-03 17:24:12 EDT
The change associated with this bug actually has some issues that make tables unusable in certain cases. I remember trying it out in my custom theme a while back.

I need to remember to post pictures of the issue and investigate further...
Comment 28 Lars Vogel CLA 2020-06-04 04:02:19 EDT
Maybe we should re-add table support only
Comment 29 Andrew Obuchowicz CLA 2020-07-12 19:03:11 EDT
(In reply to Lars Vogel from comment #28)
> Maybe we should re-add table support only

What do you mean by this? Was table support removed for this feature?

Also, I quickly tried to get this to work and wasn't able to. Maybe I'm doing something wrong though... ideally a snippet with CSS should be made to test out this feature.

I know changing the selection color in trees is doable, however (as this bug's patch proved). Further proof is that the Dev Style / Darkest dark theme will set tree & table selection color to blue on Linux, even if the selected color is something else (set by GTK theme). In my case, the selection color is red when not using Dev Style, and blue when using Dev Style. 

I'd like to investigate this further when I have time, but might need a bit of help if anyone's willing to lend a hand (either with testing, code or review). 

@Lars should I change the assignee to platform-ui-inbox? I'm not sure if Fabio has interest in continuing the work done here.
Comment 30 Rolf Theunissen CLA 2020-08-22 06:36:57 EDT
Customization for windows delivered in this fix was removed again in Bug 562865.