You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Noel Grandin <no...@gmail.com> on 2009/03/19 12:56:43 UTC

theme JSON files - names for Colours?

Hi

The JSON TerraTheme file is somewhat opaque.

Can we have names or enums for the colours rather then indexes?
And perhaps some more methods like TerraTheme#getColourDarker("xxxx"),
TerraTheme#getColourBrighter("xxx") so that the mapping from the JSON
file to code becomes more readable?

I'm willing to whip a patch for this.

Regards, Noel Grandin.

Re: theme JSON files - names for Colours?

Posted by Greg Brown <gk...@mac.com>.
>The Obsidian Theme is still alive ? 

Yes, we still use it to make sure that multiple skins are supported correctly.

>Someone think that could be expanded ?

It certainly could, though I doubt that we'll invest much time in it right now. We've tentatively discussed doing a L&F rewrite for v2.0, whenever that is. It could be based on Obsidian-like concepts - we'll see. Hopefully by then we'll be able to recruit some real graphic design talent to help us define what it should look like.



Re: theme JSON files - names for Colours?

Posted by Sandro Martini <sa...@gmail.com>.
Hi Todd,
> I disagree.  The JDK already has such methods (see
mhhh I disagree with this (for example a very interesting
implementation of what i said is found in Substance, kirill has done a
very good job) but ok, no problem, if/when necessary we could think on
this, but before we should have another real theme, and later see
if/what to refactor ... maybe future work.
The Obsidian Theme is still alive ? Someone think that could be expanded ?
Having a dark theme could be useful, also to test all default color effects.

> If we had a whole suite of such color methods, then I could see
> putting them all in a utility class.  Do I hear you volunteering to
> write such a utility? :)
OK, after the Web Start stuff i could work on this: ideas, suggestions, etc ?
Pivot has already some class like this, as structure ?

Bye,
Sandro

Re: theme JSON files - names for Colours?

Posted by Todd Volkert <tv...@gmail.com>.
> But to simplify/generalize this for other themes, if i had the methods
> below for determining color variants, i could define only few, and
> then let the skin behavior to choose what color (or its variant) to
> use (and cache it), without defining a color for background of
> buttons, one for labels, etc as you said before, because this
> generates visual noise.

Right now, the skins are coded to choose their default colors from
specific indexes within the theme's palette, so changing the number of
base colors from 8 to anything else would mess with the skins in the
theme.

> Great, but a better place for these features wouldn't be in a more
> generic Theme base class, so any theme could use this ? Or in a
> generic Color management utility class, maybe as static methods (ok,
> not so much Object Oriented in this case) ...

I disagree.  The JDK already has such methods (see
java.awt.Color.brighter and java.awt.Color.darker), but they didn't
suit the needs of this specific theme (we coded the skins in Terra to
graphic design specs built by a graphic designer at VMware).  The
methods are only 4 lines long, and since they hard code a specific
increment or decrement in the brightness value, they are very specific
to how *this* theme chooses to brighten or darken colors.  Other
themes might want to do it differently, or raise or lower saturation
values.  In any case, coding such methods to fit the specific needs of
your theme or decorator is trivial.

> And so my previous questions for other optional methods to get the
> contrast between two colors, get a color variant for a Colour
> Blindness Simulation, and many others ...

If we had a whole suite of such color methods, then I could see
putting them all in a utility class.  Do I hear you volunteering to
write such a utility? :)

-T

Re: theme JSON files - names for Colours?

Posted by Sandro Martini <sa...@gmail.com>.
Hi Todd,
great work, but i have some little complaints ...

> Ok, this has been fixed.  TerraTheme now provides a constructor that
> takes a URL, allowing you to pass a custom JSON file with the font and
> color palette properties.  I also updated the TerraTheme docs to
> better describe how the color palette is built.
Great, this is really useful, to avoid extend a theme only to change its colors.


> So instead we
> went with the notion of a palette, a notion based on the design
> process of graphic designers.  A typical graphic designer decides on a
> color palette and then choose colors from that palette without
> preconceived notions of how each color must be used.
Yes, but usually in Graphic Design only few main colors (usually 3,
max 5) are taken into the chosen Palette, then if/when needed others
the trick is to calculate others as variants of main colors, for
example changing only one of its HSV components to lighten/darken or
to change the color percentage ... in this way all seems to be more
visually coherent.
The Palette in the Terra theme contains 24 colors, but its main colors
are 8, and this is in line with what i said, ok.
But to simplify/generalize this for other themes, if i had the methods
below for determining color variants, i could define only few, and
then let the skin behavior to choose what color (or its variant) to
use (and cache it), without defining a color for background of
buttons, one for labels, etc as you said before, because this
generates visual noise.

For example, the beautiful Substance Look&Feel uses these concepts in its skins.

And: http://en.wikipedia.org/wiki/Color_blindness , and many other
references (some year ago i have read a very interesting article on
this from ibm developerworks, but now i can't find it). Again,
Substance have also these features integrated.
But maybe these questions could be handled in a future release, to
support accessibility in Pivot, also from this point of view.


And so my last question:

> Finally, note that TerraTheme /does/ provide brighten(Color):Color and
> darken(Color):Color in its public API.
Great, but a better place for these features wouldn't be in a more
generic Theme base class, so any theme could use this ? Or in a
generic Color management utility class, maybe as static methods (ok,
not so much Object Oriented in this case) ...
And so my previous questions for other optional methods to get the
contrast between two colors, get a color variant for a Colour
Blindness Simulation, and many others ...


What do you think ?


Thanks and good work,
Sandro

Re: theme JSON files - names for Colours?

Posted by Todd Volkert <tv...@gmail.com>.
> Here's a link to newly
> generated javadocs (not yet publicly linked to) that shows the default
> Terra palette and the indexes of the colors therein:
> http://incubator.apache.org/pivot/1.1/docs/api/pivot/wtk/skin/terra/package-summary.html.
>  NOTE: I just posted this content -- it will take a few hours to work
> its way to all the mirrors (and in the meantime, it will return an
> HTTP 404).

Ok, it appears that this link works now.

Re: theme JSON files - names for Colours?

Posted by Todd Volkert <tv...@gmail.com>.
> One problem right now is that it's impossible for application
> developers to provide custom palettes.  I'll be checking in a fix to
> this soon.

Ok, this has been fixed.  TerraTheme now provides a constructor that
takes a URL, allowing you to pass a custom JSON file with the font and
color palette properties.  I also updated the TerraTheme docs to
better describe how the color palette is built.

-T

Re: theme JSON files - names for Colours?

Posted by Todd Volkert <tv...@gmail.com>.
Yeah, I was actually initially a champion of naming the theme colors,
but it proved to be untenable. For example, imagine the color you
might want to call buttonBackgroundColor.  Well, that color is also
the disabled background color of calendars, the grid color of meters,
the highlight background color of table views, etc.  So instead we
went with the notion of a palette, a notion based on the design
process of graphic designers.  A typical graphic designer decides on a
color palette and then choose colors from that palette without
preconceived notions of how each color must be used.

Now that being said, the onus is on us Pivot developers to expose that
palette to application developers.  I had thought that I had included
the palette in the javadoc but had forgotten.  Here's a link to newly
generated javadocs (not yet publicly linked to) that shows the default
Terra palette and the indexes of the colors therein:
http://incubator.apache.org/pivot/1.1/docs/api/pivot/wtk/skin/terra/package-summary.html.
 NOTE: I just posted this content -- it will take a few hours to work
its way to all the mirrors (and in the meantime, it will return an
HTTP 404).

One problem right now is that it's impossible for application
developers to provide custom palettes.  I'll be checking in a fix to
this soon.

Finally, note that TerraTheme /does/ provide brighten(Color):Color and
darken(Color):Color in its public API.

Cheers,
-T

On Thu, Mar 19, 2009 at 9:31 AM, Greg Brown <gk...@mac.com> wrote:
> We actually talked about naming the colors, but there are so many different possible color combinations that we didn't think names would be meaningful. I believe we have a color palette that is meant to help navigate the indexes - Todd can provide more information here.
>
> On Thursday, March 19, 2009, at 07:56AM, "Noel Grandin" <no...@gmail.com> wrote:
>>Hi
>>
>>The JSON TerraTheme file is somewhat opaque.
>>
>>Can we have names or enums for the colours rather then indexes?
>>And perhaps some more methods like TerraTheme#getColourDarker("xxxx"),
>>TerraTheme#getColourBrighter("xxx") so that the mapping from the JSON
>>file to code becomes more readable?
>>
>>I'm willing to whip a patch for this.
>>
>>Regards, Noel Grandin.
>>
>

Re: theme JSON files - names for Colours?

Posted by Greg Brown <gk...@mac.com>.
We actually talked about naming the colors, but there are so many different possible color combinations that we didn't think names would be meaningful. I believe we have a color palette that is meant to help navigate the indexes - Todd can provide more information here.
 
On Thursday, March 19, 2009, at 07:56AM, "Noel Grandin" <no...@gmail.com> wrote:
>Hi
>
>The JSON TerraTheme file is somewhat opaque.
>
>Can we have names or enums for the colours rather then indexes?
>And perhaps some more methods like TerraTheme#getColourDarker("xxxx"),
>TerraTheme#getColourBrighter("xxx") so that the mapping from the JSON
>file to code becomes more readable?
>
>I'm willing to whip a patch for this.
>
>Regards, Noel Grandin.
>

Re: theme JSON files - names for Colours?

Posted by Sandro Martini <sa...@gmail.com>.
Hi,
good idea, but i prefer the names case, or maybe with a standard enum
to use for names, like BACKGROUND, BASE, LIGHT, DARK, LIGHTER, DARKER
... .
Then, why not to extend this also to other elements, like font,
instead of having only one ?


Then, what do you think on adding also something like boolean
isThemeDark() (reading a property in the json file, or maybe fixed in
any theme) ?
This could help to do math operations in inverse mode, like lightening
a color if the background is dark, etc ...

Bye,
Sandro