Listen Print

How to Change Your Look With Mozilla Skins
Pages: 1, 2, 3, 4, 5

The Chrome Registry and RDF

The chrome registry is the set of files that Mozilla uses to describe the structure of skin and locale information on the user's system. Skin installations and selections read from and write to the chrome registry.

There are five RDF files maintained by the chrome registry:

RDF Files in the Chrome Registry

all-skins

a table of all installed skins, complete with all of the relevant information for each

user-skins

the user's current selections

all-locales

a table of all installed locales

user-locales

the user's current locale selections

all-packages

a table of all installed packages, complete with information about each

Each of the files uses the Resource Description Framework (RDF) to describe the skin and locale resources. The all-skins.rdf file, for example, takes the following format:

<?xml version="1.0"?> 
<RDF:RDF 
 xmlns:chrome="http://www.mozilla.org/rdf/chrome#" 
 xmlns:RDF= 
   "http://www.w3.org/1999/02/22-rdf-syntax-ns#"> 

 <!-- A list of all installed skins --> 
 <RDF:Seq about="urn:mozilla:skin:root"> 
   <RDF:li 
resource="urn:mozilla:skin:aqua/1.0"/ <urn:mozilla:skin:aqua/1.0> > 
 </RDF:Seq> 

 <!-- Information for the Aqua skin --> 
 <RDF:Description 
about="urn:mozilla:skin:aqua/1.0"> 
   <chrome:displayName>Aqua 
   </chrome:displayName> 
   <chrome:author>Steve Jobs 
   </chrome:author> 

   <chrome:previewURL> 
http://www.mac-rabies.org/mozilla-skin.gif 
   </chrome:previewURL> 

   <chrome:packages 
    resource="urn:mozilla:skin:aqua/1.0:packages"/ <urn:mozilla:skin:aqua/1.0:packages> > 
   </RDF:Description> 

 <!-- A list of the affected packages --> 
 <RDF:Seq 
   about="urn:mozilla:skin:aqua/1.0:packages"> 
   <RDF:li 
     resource="urn:mozilla:skin:aqua/1.0:global"/ <urn:mozilla:skin:aqua/1.0:global> > 
   </RDF:Seq> 

 <!-- The base URL for a given package --> 
 <!-- and skin entry, plus a convenience --> 
 <!-- pointer to the package resource --> 
 <RDF:Description 
   about="urn:mozilla:skin:aqua/1.0:global"> 
   <chrome:baseURL>resource:/chrome/ 
   </chrome:baseURL> 
   <chrome:package 
resource="urn:mozilla:package:global"/ <urn:mozilla:package:global> > 
 </RDF:Description> 

</RDF:RDF>

If you're familiar with RDF, you can see that the RDF for each skin describes a number of important things about it: Metadata such as the author and name, a url for viewing a preview, a list of affected packages (which are themselves described in the all-packages.rdf part of the registry), and the url for getting to the skin are all included in the RDF. When skins are registered in this way, they can be applied to packages or to the whole application very simply, for example within a simple browser dialog that takes advantage of the metadata to display basic information about each skin and perhaps display a preview.

The other registry files have a similar structure for describing the locale, the particular files that the user has selected, and the packages installed on the system.

Where To Go From Here

Resources

Writing Skinnable XUL and CSS

Writing Efficient CSS

Mozillazine's ChromeZone

AlphaNumerica

Skinning XUL Files By Hand

As a collection of CSS files and images, your browser's default skin can be played with and altered in innumerable ways. One of the best ways to familiarize yourself with the way that skins work is to edit some of the style statements already present in the default skin and view the results. This way, you don't need to perform any new installation procedures, and you will learn what parts of the browser's look are determined by which files.

From there, you might consider grabbing a skin zip file, giving it an overhaul, and then testing the installation procedures outlined in this article. Finally, creating a new skin for the Mozilla browser and packaging it for installation provides the most challenge and flexibility.

There are a few things that need to be stabilized and resolved before skins are switchable, installable, and settled entirely. But that point is very close. There's already useful documentation about creating skins available on the Mozilla web site, and new documentation and functionality are still being checked in. In the meantime, the sheer coolness of skins -- their power, flexibility, and standards support -- makes the learning process constructive and rewarding.

Ian Oeschger is a Senior Principal Writer at Netscape Communications.


Discuss this article in the O'Reilly Network General Forum.

Return to the O'Reilly Network Hub.