Closed Bug 849223 Opened 11 years ago Closed 10 years ago

Make the CSS3 color system module customizable via mozSettings to enable gaia themes

Categories

(Firefox OS Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
1.3 C2/1.4 S2(17jan)

People

(Reporter: vingtetun, Assigned: etienne)

References

Details

Attachments

(2 files, 4 obsolete files)

Attached patch poc (obsolete) — Splinter Review
Right now we are pushing building blocks. The current way to do it is for people to embed the CSS in their app directly. The main issue with that beeing that if we change the color of the headers or any other part that won't be reflected and third party apps will look out of place.

This will also affects the notes app and any apps that don't belong to Gaia.

Using CSS 3 colors modules will let us abstract this and so OEM and carriers will be able to customize the default set of colors used in apps. Third party apps will be able to opt-in to it if needed and even websites. That will offer an easy way to look integrated into the system whatever default color theme it is, so the same app will look integrated in various different color theme of Firefox OS without requiring any changes.

That will also make sure people don't fork an application just to have a default color that is different than the orange one.
For example you can do: |background: menu -moz-linear-gradient(top, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.5) 100%);| in the section[role="region"] > header:first-child  of the header.css building block.


Then from user.js you can change this list of keywords: http://mxr.mozilla.org/mozilla-central/source/b2g/app/b2g.js#198
We were not using any CSS3 gradients as there was performance problems with it.
Do we solved that problems?

Thx!
So this is working like "variables" for color types?
(In reply to Ismael from comment #2)
> We were not using any CSS3 gradients as there was performance problems with
> it.
> Do we solved that problems?
> 

Not that I know of.

This bug is still at the exploration stage, but we could probably use gradient images made to be layered on top of a background color.
(In reply to Etienne Segonzac (:etienne) from comment #4)
> This bug is still at the exploration stage, but we could probably use
> gradient images made to be layered on top of a background color.

Sure a semi-transparent png file will work also!

(In reply to Vivien Nicolas (:vingtetun) (:21) (away until march 25th) from comment #1)
> For example you can do: |background: menu -moz-linear-gradient(top,
> rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.5) 100%);| in the section[role="region"] >
> header:first-child  of the header.css building block.
> 
> 
> Then from user.js you can change this list of keywords:
> http://mxr.mozilla.org/mozilla-central/source/b2g/app/b2g.js#198

CSS2 system colors seems to be deprecated in the new CSS3 color module:
http://www.w3.org/TR/css3-color/#css2-system
With this patch we're binding the color values for those keywords:

    menu
    menuText
    appworkspace
    window
    windowText
    infoBackground
    buttonFace
    highlight

to theirs gaia.ui._keyword_ equivalent
(In reply to Etienne Segonzac (:etienne) from comment #7)
> Created attachment 726772 [details] [diff] [review]
> Gaia patch to have default values for the colors

Are you waiting for anything else before asking for a r? ?
Flags: needinfo?(etienne)
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #8)
> (In reply to Etienne Segonzac (:etienne) from comment #7)
> > Created attachment 726772 [details] [diff] [review]
> > Gaia patch to have default values for the colors
> 
> Are you waiting for anything else before asking for a r? ?

It probably needs a bit of rebasing and reasonable default colors before the review :)
Flags: needinfo?(etienne)
(In reply to Etienne Segonzac (:etienne) from comment #9)
> (In reply to Vivien Nicolas (:vingtetun) (:21) from comment #8)
> > (In reply to Etienne Segonzac (:etienne) from comment #7)
> > > Created attachment 726772 [details] [diff] [review]
> > > Gaia patch to have default values for the colors
> > 
> > Are you waiting for anything else before asking for a r? ?
> 
> It probably needs a bit of rebasing and reasonable default colors before the
> review :)

It does not even needs any color define. Just support the definition of those colors via a pref.
(In reply to Vivien Nicolas (:vingtetun) (:21) from comment #10)
> (In reply to Etienne Segonzac (:etienne) from comment #9)
> > (In reply to Vivien Nicolas (:vingtetun) (:21) from comment #8)
> > > (In reply to Etienne Segonzac (:etienne) from comment #7)
> > > > Created attachment 726772 [details] [diff] [review]
> > > > Gaia patch to have default values for the colors
> > > 
> > > Are you waiting for anything else before asking for a r? ?
> > 
> > It probably needs a bit of rebasing and reasonable default colors before the
> > review :)
> 
> It does not even needs any color define. Just support the definition of
> those colors via a pref.

Well when the setting binded to a pref is undefined (likely when for phones that will get this through updates) we need to have _something_ :)
This poc, made my day :)_

Really glad to see this moving forward, do you need any help guys?
Summary: Use CSS3 color system modules in building blocks → Make the CSS3 color system module customizable via mozSettings to enable gaia themes
Attached patch Gecko part (obsolete) — Splinter Review
Reviving this old bug.

If using the (deprecated?) system colors to theme gaia is ok, I'd like to land this and open follow up bugs to update the building blocks during the next visual refresh.
Attachment #722776 - Attachment is obsolete: true
Attachment #726727 - Attachment is obsolete: true
Attachment #8360492 - Flags: review?(21)
Attachment #8360492 - Flags: feedback?(dbaron)
Attached patch Gaia partSplinter Review
Attachment #726772 - Attachment is obsolete: true
Attachment #8360493 - Flags: review?(21)
Comment on attachment 8360492 [details] [diff] [review]
Gecko part

Review of attachment 8360492 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with the code moved to settings.js. The list of colors can probably be enhanced later.

::: b2g/chrome/content/shell.js
@@ +1211,5 @@
> +        Services.prefs.setCharPref(pref, value);
> +      }
> +    });
> +  });
> +})();

Can you move this code to b2g/chrome/content/settings.js ?
Attachment #8360492 - Flags: review?(21) → review+
Comment on attachment 8360492 [details] [diff] [review]
Gecko part

Why are the nsLookAndFeel.cpp changes needed?

They look wrong to me.  I thought the setup was that the cross-platform code (widget/xpwidgets/nsXPLookAndFeel.cpp) has a GetColor function that will use the pref value if the pref is set, and if it isn't, will call NativeGetColor.  (It uses the same cache both for the pref values and for memoized results of NativeGetColor, so it's not immediately obvious looking at the code, though.)  So it seems really strange for NativeGetColor to be calling GetColor.  (How does it not cause infinite recursion?  Perhaps because the code is never reached because the prefs are always set?)

Otherwise this seems fine... though at that point there aren't any Gecko changes left.
Attachment #8360492 - Flags: feedback?(dbaron) → feedback-
Attached patch Gecko part v2Splinter Review
Quick r? because the patch changed a bit.
Now it's tiny!
Attachment #8360492 - Attachment is obsolete: true
Attachment #8360990 - Flags: review?(21)
(In reply to David Baron [:dbaron] (needinfo? me) (UTC-8) from comment #19)
> Comment on attachment 8360492 [details] [diff] [review]
> Gecko part
> 
> Why are the nsLookAndFeel.cpp changes needed?
> 
> They look wrong to me.  I thought the setup was that the cross-platform code
> (widget/xpwidgets/nsXPLookAndFeel.cpp) has a GetColor function that will use
> the pref value if the pref is set, and if it isn't, will call
> NativeGetColor. 

Thanks! It works perfectly, patch updated.
Comment on attachment 8360990 [details] [diff] [review]
Gecko part v2

Review of attachment 8360990 [details] [diff] [review]:
-----------------------------------------------------------------

Oh that sounds soo easy now...
Attachment #8360990 - Flags: review?(21) → review+
Gecko part: https://hg.mozilla.org/integration/mozilla-inbound/rev/72be9c70269a

Please keep opened until the Gaia part lands.
Status: NEW → ASSIGNED
Target Milestone: --- → DeveloperPhone
https://hg.mozilla.org/mozilla-central/rev/72be9c70269a
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: DeveloperPhone → 1.3 C2/1.4 S2(17jan)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: