Merge lp:~gcollura/content-hub/fix-1384490 into lp:content-hub

Proposed by Giulio Collura on 2014-10-30
Status: Needs review
Proposed branch: lp:~gcollura/content-hub/fix-1384490
Merge into: lp:content-hub
Diff against target: 43 lines (+4/-4)
2 files modified
import/Ubuntu/Content/ContentPeerPicker10.qml (+2/-2)
import/Ubuntu/Content/ContentPeerPicker11.qml (+2/-2)
To merge this branch: bzr merge lp:~gcollura/content-hub/fix-1384490
Reviewer Review Type Date Requested Status
Michael Sheldon (community) 2014-10-30 Needs Fixing on 2014-11-04
Review via email: mp+240156@code.launchpad.net

Commit Message

Fix bug #1384490 by setting a different background color for ContentPeerPicker.

Description of the Change

I changed the default background of the ContentPeerPicker to Theme.palette.normal.background. If the the app has a dark background, ContentPeerPicker will have a proper background color (it's actually purple, point me to the correct color to choose). Ideally, the developer should be able to choose which background the component should have, maybe we could expose a property like "backgroundColor:".
Let me know what you think about this idea.

Thanks in advance,
Giulio

To post a comment you must log in.
Michael Sheldon (michael-sheldon) wrote :

I think it's best if we pick up the colour from the Theme palette as this is how the developer should be customising colour throughout the app, however I think we need to do some extra things to match the way the UITK uses these properties, I'll have a bit of look into this and get back to you on what I find.

Aside from that it looks like you've got a couple of typos for Qt.rgba listed as Qt.rbga (g and b switched around), so dark layouts still get the white background. However, with these corrected the apps box for light backgrounds becomes gray, so we might need to think about that a bit more.

review: Needs Fixing
Giulio Collura (gcollura) wrote :

Thanks for the review!

> I'll have a bit of look into this and get back to you on what I
> find.

Ok, thanks a lot :)

> Aside from that it looks like you've got a couple of typos for Qt.rgba listed
> as Qt.rbga (g and b switched around),

Ops, sorry for the typo. (fixed it)

> so dark layouts still get the white
> background.

The alpha layer is set to 0.1, so it's just a bit lighter, but still a dark grey (at least in my tests)

> However, with these corrected the apps box for light backgrounds
> becomes gray, so we might need to think about that a bit more.

I thought it would have been better to remove that background color of the Rectangle and leave everything of the same color, tell me what you think :)

Thanks again for the review

Giulio

lp:~gcollura/content-hub/fix-1384490 updated on 2014-11-04
161. By Giulio Collura on 2014-11-04

fix rgba typo. make rectangle color transparent

Michael Sheldon (michael-sheldon) wrote :

At this stage it'd be best to keep the design the same for use cases that already work in apps (i.e. with light coloured backgrounds). We can use the same technique the UITK uses to determine whether something has a light background or not via ColorUtils, so if it has a light background set a white apps area, otherwise leave it transparent for darker backgrounds, for example:

color: ColorUtils.luminance(Theme.palette.normal.background) >= 0.85 ? "#FFFFFF" : Qt.rgba(0, 0, 0, 0)

Should do the trick.

I still need to figure out what the UITK does with the background colour though, as the colour that gets set as Theme.palette.normal.background is modified in some way from the colour the user actually sets as the MainView's backgroundColor. It might end up being that we'll have to expose explicitly backgroundColor properties on the Peer Picker, but I want to make sure we can't do it automatically first.

lp:~gcollura/content-hub/fix-1384490 updated on 2014-11-07
162. By Giulio Collura on 2014-11-07

use ColorUtils.luminance to determine background color

Giulio Collura (gcollura) wrote :

I updated my branch using your suggestion.

Michael Sheldon (michael-sheldon) wrote :

Sorry! We've decided to take another approach to fixing this bug, since it isn't really possible for us to mimic the application's colours correctly without the developer having to explicitly set headerColor/backgroundColor/footerColor properties on the peer picker and then us copying gradient stops from the UITK (which could then easily get out of sync if this is changed in the UITK), we've decided to have the peer picker keep the same light appearance across all applications and just force the font colour to be correct. I'll see about preparing a branch with the new approach this week, since it might require a bit of fiddly work for the 1.0 implementation (since only UITK 1.1 allows explicitly setting the header colour).

Michael Hall (mhall119) wrote :

Not having a proper way to change the ContentPeerPicker colors makes it less ideal for apps that define their own colors. Which means those developers will either avoid using it and roll their own, or do some nasty hacks to force it to change color (I'm currently doing the later).

Unmerged revisions

162. By Giulio Collura on 2014-11-07

use ColorUtils.luminance to determine background color

161. By Giulio Collura on 2014-11-04

fix rgba typo. make rectangle color transparent

160. By Giulio Collura on 2014-10-30

Fix bug #1384490

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'import/Ubuntu/Content/ContentPeerPicker10.qml'
2--- import/Ubuntu/Content/ContentPeerPicker10.qml 2014-10-10 15:28:39 +0000
3+++ import/Ubuntu/Content/ContentPeerPicker10.qml 2014-11-07 13:37:12 +0000
4@@ -40,7 +40,7 @@
5
6 Rectangle {
7 anchors.fill: parent
8- color: Theme.palette.normal.overlay
9+ color: Theme.palette.normal.background
10 }
11
12 Header {
13@@ -160,7 +160,7 @@
14
15 Rectangle {
16 id: apps
17- color: "#FFFFFF"
18+ color: ColorUtils.luminance(Theme.palette.normal.background) >= 0.85 ? "#FFFFFF" : Qt.rgba(0, 0, 0, 0)
19 clip: true
20 anchors {
21 left: parent.left
22
23=== modified file 'import/Ubuntu/Content/ContentPeerPicker11.qml'
24--- import/Ubuntu/Content/ContentPeerPicker11.qml 2014-10-10 15:28:39 +0000
25+++ import/Ubuntu/Content/ContentPeerPicker11.qml 2014-11-07 13:37:12 +0000
26@@ -41,7 +41,7 @@
27
28 Rectangle {
29 anchors.fill: parent
30- color: Theme.palette.normal.overlay
31+ color: Theme.palette.normal.background
32 }
33
34 Header {
35@@ -177,7 +177,7 @@
36
37 Rectangle {
38 id: apps
39- color: "#FFFFFF"
40+ color: ColorUtils.luminance(Theme.palette.normal.background) >= 0.85 ? "#FFFFFF" : Qt.rgba(0, 0, 0, 0)
41 clip: true
42 anchors {
43 left: parent.left

Subscribers

People subscribed via source and target branches