If you want to get it the exact same way Unity does, look at the code
in unity-shared/BGHash.cpp in the Unity source. It uses the
_GNOME_BACKGROUND_REPRESENTATIVE_COLORS X window property from the
root window, which presumably gets updated by Gnome when the wallpaper
changes.
I've attached a quick Python script which outputs that property in CSS
hex format, which looks like the format you use.
On 24 May 2012 19:12, Matt Richardson <m.richardson.1990@xxxxxxxxxxxxx
<mailto:m.richardson.1990@xxxxxxxxxxxxx>> wrote:
OK so I have created a proof of concept using ImageMagick to get
the average colour and bash and sed to then replace the specific
values in the gtk.css, gtk-widgets.css, gtkrc and
metacity-theme-1.xml files.
You can download it here <http://ubuntuone.com/6oslxzNUw5GOGCq4Wzqhup>
1) Extract the files to ~/.themes
2) Copy the "Chameleon Script.sh" file to somewhere more easy to
access
3) You will need to use MyUnity (or similar) to change the theme
to 'Chameleon', since the 'Appearances' settings panel doesn't
display it.
4) Run "Chameleon Script.sh"
5) Most applications will simply need closing and reopening to update.
6) I'm not entirely sure why but programs with workaround css
files (including nautilus and unity) won't update until you log
out and back in. Until you do this Nautilus and the top panel (as
well as menus thereof) will not change.
ImageMagick came installed by default I think (I don't recall
installing it), but if it's not a default tool then you can
install it from the software center. In the long run, this script
would hopefully be incorporated into Unity
Known issues:
1) Does not update automatically when the wallpaper is changed.
You have to run the script each time you change wallpaper.
2) Nautilus, Unity and potentially some others do not update until
log out/in
3) Colour matching is not quite the same as Unity. Most of the
time the theme produces a closer match to the wallpaper than Unity
(IMO) but it can be affected by a small presence of a very bright
colour. It would also be better if it could match Unity perfectly
to provide seamless aesthetics.
4) Cannot handle xml files, as used by wallpapers that change
during the day.
5) The currently highlighted button (not in toolbars) displays
dark text on a dark background (with some wallpapers). I can't
find the value which changes that at the moment.
Hopefully, were this integrated into the same code that updates
Unity's chameleonic elements, issues 1 to 4 would all be solved.
Issue 5 is just a matter of time, but I decided to see what people
think before continuing.
Feedback would be appreciated
Matt
On 22/05/12 12:09, Matt Richardson wrote:
I would really like to see a chameleonic theme land in 12.10.
Not a transparent theme. Instead simply the ambiance theme (light
to dark vertical gradient) but where the base colour is taken as
the average colour of the wallpaper.
I also think this would help the top-left corner issue, as the
launcher, panel and window would blend a lot better.
Also, this wouldn't prevent the user from selecting
non-chameleonic themes, as some people would prefer the contrast.
Thoughts?
Matt
--
Mailing list: https://launchpad.net/~unity-design
<https://launchpad.net/%7Eunity-design>
Post to : unity-design@xxxxxxxxxxxxxxxxxxx
<mailto:unity-design@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~unity-design
<https://launchpad.net/%7Eunity-design>
More help : https://help.launchpad.net/ListHelp