Snippets code from my daily experience

December 23, 2007

How to detect the current active theme name on Firefox

Filed under: extension, firefox, gecko, nsIPrefBranch, skin, theme, xpcom — dafi @ 6:42 pm

Sometime obtaining informations about components isn’t so quick, you must iterate over RDF, XML or call many API.

Sometime is very simple like get a pref string… well this time I’m lucky ;-)

The pref general.skins.selectedSkin contains the current active theme name.

var currentThemeName = Components.classes['@mozilla.org/preferences-service;1']
.getService()
.QueryInterface(Components.interfaces.nsIPrefBranch)
.getCharPref("general.skins.selectedSkin");

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.