Fwd: Icon Theme Support

Mark Fortner phidias51 at gmail.com
Sun Oct 21 10:08:46 PDT 2012


Sorry about not sending this directly to the list.  I keep tripping over
the fact that by default it only sends the reply directly to the sender.
 Somebody please fix this.



---------- Forwarded message ----------
From: Mark Fortner <phidias51 at gmail.com>
Date: Sun, Oct 21, 2012 at 10:05 AM
Subject: Re: Icon Theme Support
To: jonathan.giles at oracle.com


Hi Jonathan,
Given the size of the desktop applications, an additional few Mb doesn't
make that big of a difference.  But you do bring up a good point about
being able to cherry pick icons.  Maven has a plugin called Shade which is
useful in reducing the size of the resultant artifact.  Usually we use it
when we want to cherry pick classes from large libraries and create an uber
jar that contains the application classes + the cherry picked classes.  It
makes me wonder if something similar already exists for dealing with
resources.

The workflow would then resemble what most people currently do with
libraries:

   1. Add a dependency from mvnrepository.com (or in this case a resource
   dependency) to your POM.
   2. Maven would automatically download and install the resource in your
   local .m2/repository.
   3. Build your application and Shade the resulting JAR (or in this case
   perhaps "Shard" the resources).


The primary disadvantage to manually cherry picking icons, is that often
the resultant application reflects that cherry picking.  Developer A
chooses his icons from Theme 1, and Developer B chooses his icons from
Theme 2.  And the results look horrendous to the end user.

The other thing I wonder, is how someone would control which icon theme was
selected?  I could envision these scenarios:

   1. The developer wants to specify 3 themes (1 per OS they plan to
   support), and have a factory automatically switch between those three
   choices whenever the user loads the applications.  The CSS stylesheets *
   -fx-image* references would need to automatically resolve the
   appropriate icon from the appropriate icon theme.  The developer would want
   to treat icons in all themes within has classpath as *mutually
exclusive*-- only one theme would get used at a time.
   2. The developer wants a single look and thus the URL resolver only has
   to focus on retrieving icons from a single theme.  The developer perhaps
   selects a different icon factory for this.
   3. The developer wants to use two closely related themes, that are
   graphically similar (like general Tango theme, and the Tango theme for
   graphics applications like the GIMP).  The developer would want to treat
   icons in all themes within his classpath as *mutually inclusive*.
   4. The developer wants to provide the users with the ability to switch
   between icon themes as part of the application preferences.
   5. The developer needs to support different icon sizes to support
   different resolutions, or the needs of users with different levels of
   visual acuity.

*<slightly-off-topic>*
The Less library that Dan pointed out looks particularly interesting.  I
like that you can dynamically change the style sheet.  One of the things
that I currently find bothersome is that you can't map arbitrary states to
pseudo selectors.  Currently you have a pseudo selector like ":hover", but
it would be nice if the developer could map any state or combination of
states to a style.
*</slightly-off-topic>*

Cheers,

Mark





On Sat, Oct 20, 2012 at 7:36 PM, Jonathan Giles
<jonathan.giles at oracle.com>wrote:

> I'm interested to hear if this is common practice. In one of my past lives
> as a Swing client application developer I would always cherry pick the
> icons I wanted to use out of the icon packs I had available to me, rather
> than try to ship an entire icon pack (or multiple icon packs). From my
> experience icon packs tend to be rather large (when taking into account
> they normally ship with some permutation of 16x16, 24x24, 32x32, 48x48,
> 64x64 pixel .png, .svg and .ico files).
>
> So, in short, is shipping an entire, or multiple, icon packs something
> that people actually want to do, and if so, would some kind of library
> support for this be beneficial?
>
> As a secondary question / comment: this seems like something that a third
> party library could offer - rather than being necessarily included in
> JavaFX itself?
>
> -- Jonathan
>
>
> On 21/10/2012 5:58 a.m., Mark Fortner wrote:
>
>> I was wondering if anyone had given any thought to supporting Icon Themes
>> in JavaFX?  When you look at Swing apps (and now JavaFX apps) you find a
>> lot of the same icons borrowed from various Linux icon themes.  Invariably
>> someone has taken apart the theme's archive, and extracted the icons that
>> they wanted and simply added them as resources to their project.  However,
>> that misses some of advantages of having a theme in the first place --
>> namely that if you use the standard naming conventions for icons, then you
>> should be able to do drop-in replacements of the icons without having to
>> change your code.  This makes is possible to freshen up the look of your
>> app, or to use icon themes that fit a specific OS.  After all, do you
>> really want Tango icons on your nice clean OS X app?  Moreover, it would
>> make it possible for user's to customize the look of their apps without
>> developer involvement.
>>
>> Which brings me rather circuitously back to my point -- is there a way to
>> support icon themes in CSS?  For example, I'd like to simply drop *
>> AwOken.tar.gz* into my classpath, and have an icon reference like this
>> resolve properly: *-fx-image: url('clear/24x24/apps/**
>> ubuntuone-client.png');*
>> *
>>
>> *
>> Ideally, this should happen without having to repackage the icon themes
>> into a JAR since themes are often stored in a variety of formats tar.gz,
>> rar, zip, etc.
>>
>>
>> Cheers,
>>
>> Mark
>>
>
>


More information about the openjfx-dev mailing list