You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by dranzer_duch <al...@gmail.com> on 2011/02/09 10:37:06 UTC

Applying custom Color themes to pivot app.

Hi,

i need to apply different color themes to my pivot application.
As of now i hard code the color code for every background color, etc. in my
BXML file.

What i want is, say provide options to user, to apply say a purple color
theme to my application (does not support browser viewing), and if i change
the selection to green color theme, the appropriate effects should take
place ( and later on provide some custom control styles as per the theme
selected).

I would like to see some small example that helps in accomplishing this, or
some guidance as to how this would be accomplished.

Thanks,
Aakanksha


-----
Aakanksha
-- 
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Applying-custom-Color-themes-to-pivot-app-tp2457362p2457362.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Applying custom Color themes to pivot app.

Posted by dranzer_duch <al...@gmail.com>.
Thanks Sandro and Greg.

I'll work it up! ;)

-----
Aakanksha
-- 
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Applying-custom-Color-themes-to-pivot-app-tp2457362p2465386.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Applying custom Color themes to pivot app.

Posted by Greg Brown <gk...@verizon.net>.
Color schemes are described here:

http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/skin/terra/package-summary.html

The default color scheme descriptor is here:

http://svn.apache.org/repos/asf/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTheme_default.json

By following this format, you can create your own custom theme descriptors. You can specify them at application startup as Sandro described, using the org.apache.pivot.wtk.skin.terra.location system property:

-Dorg.apache.pivot.wtk.skin.terra.location=/com/foo/bar/MyTheme.json

G

On Feb 9, 2011, at 6:42 AM, dranzer_duch wrote:

> 
> Actually yeah, i would like to see some small example that shows, how the
> parameters taken care of in the bxml file, and how the parameters are passed
> when skins are used..
> 
> 
> Say for example, I have something like:
> 
> <Label text="%heading" styles="{font:'Arial bold 14', color:'#347235'}/>
> in my bxml file, I want to know how to use the skin customization on this
> tag(or a similar tag)
> and what are the other changes i need to make in json or my java file.
> 
> Actually i am not too clear on the usage of skins.
> 
> Thanks
> 
> -----
> Aakanksha
> -- 
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Applying-custom-Color-themes-to-pivot-app-tp2457362p2457871.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Applying custom Color themes to pivot app.

Posted by dranzer_duch <al...@gmail.com>.
Actually yeah, i would like to see some small example that shows, how the
parameters taken care of in the bxml file, and how the parameters are passed
when skins are used..


Say for example, I have something like:

<Label text="%heading" styles="{font:'Arial bold 14', color:'#347235'}/>
in my bxml file, I want to know how to use the skin customization on this
tag(or a similar tag)
and what are the other changes i need to make in json or my java file.

Actually i am not too clear on the usage of skins.

Thanks

-----
Aakanksha
-- 
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Applying-custom-Color-themes-to-pivot-app-tp2457362p2457871.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Applying custom Color themes to pivot app.

Posted by Sandro Martini <sa...@gmail.com>.
Hi,

The default Pivot L&F supports configurable color schemes, and by default
the Skin at application startup read a json config file containing the
definition of its base colors (and other settings).
A simple way to customize your colors is to give a startup parameter to the
application so Pivot can use your skin customized colors, for example
something like this:

>For example, try to execute this (but note that's not a real command line,
I put here only as a reference for needed options):
>
>java org.apache.pivot.wtk.DesktopApplicationContext
org.apache.pivot.demos.styles.ColorSchemeBuilder
-Dorg.apache.pivot.wtk.skin.terra.location=TerraTheme_ubuntu.json
>
>Note that colors files bundled with Pivot can be loaded without put in
front of file name the path (as in my sample), but for others it's needed
(and should be an absolute path, starting with a "/" char and
substitute any "." of the package with a "/" char, like in ResourceBundles
... for example, to load the dark sample (inside tutorials), you have to
use:
> -Dorg.apache.pivot.wtk.skin.terra.location=/org/apache/pivot/tutorials/TerraTheme_dark.json


In Pivot 2.0 there are some "custom" json files in Pivot 2.0, for trying to
have a look similar to Windows, OS X, Ubuntu, etc., they are all
TerraTheme_*.json files.


To create your own, a good Tool is the "Color Scheme Creator", so you can
see in live mode how they look, and you can save (but note that the saved
file contains only the color definition, so you can't directly use it to
load your application ... you will have to merge it with one of "good" json
files).

Note that the skin uses colors for the same elements so sometimes it's not
possible to use a color where you want ... soon or later I have to write an
article with more detail on how to customize colors here :-) .


Just for reference, the issue was this (
https://issues.apache.org/jira/browse/PIVOT-579 ), closed (resolved) in the
2.0
Some discussion on it here:
http://apache-pivot-users.399431.n3.nabble.com/Feedback-on-First-screenshots-of-Custom-Colors-PIVOT-579-td1217213.html

For the 2.1 release I'm planning to extend this a little ...


Tell me if you need more info, or if you have suggestions.

Bye,
Sandro


-- 
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Applying-custom-Color-themes-to-pivot-app-tp2457362p2457572.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.