Download the latest version of Firefox and install it. Be sure to install the DOM Inspector extension as well.
Extract Theme
While you can hypothetically begin with any theme already designed for Firefox, for the sake of consistency we'll speak as though everyone is editing the default Firefox theme. This is located in the file classic.jar
found in the Firefox installation directory. A .jar file is in reality a renamed zip archive. Opening the .jar files in your archive manager of choice should result in the file being automatically detected as being a zip archive. However, if your application doesn't detect classic.jar
as a standard zip archive, rename the file classic.zip
and continue extraction.
Note: Starting in Gecko 2.0, the new omni.jar
file contains the skin, among other resources. See Theme changes in Firefox 4 for details on how to extract skin files from Firefox 4 or later.
Classic.jar locations
Linux: /usr/lib/MozillaFirefox/chrome/classic.jar or /usr/lib/firefox-*.*.*/chrome/classic.jar
Windows: \Program Files\Mozilla Firefox\chrome\classic.jar
For Mac OS X:
- Go to your applications folder
- Control click application icon(Firefox icon), choose Show Package Contents.
- Go to contents/MacOS/Chrome/classic.jar
Copy classic.jar
to another easily accessible folder -- Classic
is recommended -- extract the contents of that folder, being sure to maintain the directory structure.
Directories
Inside classic.jar
is one directory, skin
, as well as two files, preview.png
and icon.png
.
-
skin
-
skin
simply contains another directory,classic
which holds all the good stuff. -
skin\classic
-
classic
contains the following directories. -
skin\classic\browser
-
browser
contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. -
skin\classic\communicator
- Doesn't do a whole lot and can typically be forgotten about promptly.
-
skin\classic\global
-
global
contains almost all of the important CSS files that define the appearance of the browser. This is the most critical directory in a theme. -
skin\classic\help
-
help
contains all the files for theming the help dialog window. -
skin\classic\mozapps
-
mozapps
contains all the styles and icons for the browser peripherals, such as the extension manager or update wizard.
Install Your New Theme
Before you can see the changes you make to a Firefox theme (since live edits are restrictively difficult to set up) you must first learn how to repackage the classic theme to make it installable. For the sake of this discussion we will call your theme "My_Theme", though you can replace that with any name.
Copying The Necessary Files
The first step is to move all the files into the right directory structure. So create a new directory called My_Theme
. Into this directory put the browser
, global
, communicator
, help
, and mozapps
directories from above, as well as the icon.png
and preview.png
files. (Yes, this means that the structure of your new directory and classic.jar
will be slightly different.)
Creating the Install Files
Contents.rdf
Make a copy of contents.rdf, place it in \My_Theme
and open it up in your text editor. This file is a small XML Database which is used to describe the skin.
In the code, search for all instances of "My_Theme" and replace them with the name of your theme.
The packages section lists which components of the browser you're modifying. If we also had skins for Chatzilla, we would need to add another line resembling the other ones and change it to point to Chatzilla. But this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this.
<RDF:li resource="urn:mozilla:skin:My_Theme:communicator"/> <RDF:li resource="urn:mozilla:skin:My_Theme:editor"/> <RDF:li resource="urn:mozilla:skin:My_Theme:global"/> <RDF:li resource="urn:mozilla:skin:My_Theme:messenger"/> <RDF:li resource="urn:mozilla:skin:My_Theme:navigator"/>
Save the file and exit the text editor.
install.rdf
Make a copy of install.rdf and place it in the My_Theme
directory, then open it up in your text editor. This file is a small XML database that describes the skin.
<Description about="urn:mozilla:install-manifest"> <em:id>{Themes_UUID}</em:id> <em:version>Themes_Version</em:version>
The first section requires that you establish a UUID for your theme and that you give your theme a version number. Once you've done this, insert the information as above, and scroll down.
You will also have to update the minimum and maximum compatible versions for the target application (Firefox) in the following section:
<em:targetApplication> <Description> <!-- Firefox's UUID --> <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <em:minVersion>Min_FF_Version</em:minVersion> <em:maxVersion>Max_FF_Version</em:maxVersion> </Description> </em:targetApplication>
Establishing both minimum and maximum compatible versions lets you avoid conflicts with versions of Firefox your theme wasn't designed for -- or wasn't tested on.
See Install Manifests for the reference information about the install.rdf
file.
CSS Files
The CSS files in these directories tell the browser how to display the buttons and other controls, where to put the images, what border and padding it should put around them, and so on.
As an example, let's change the standard button.
Go into the global global
directory and open button.css
in your favorite text editor. Scroll down to "button {"
. This section defines the normal button in its basic state (There is no mouse over it, it's not disabled, and it's not selected).
Change the background-color:
to DarkBlue
and the color:
to White
, and save the file.
Repackaging JAR
Now all you need to do is repackage a JAR file with the following directory structure, using your favorite archive manager to create a zip archive:
/browser/* /communicator/* /global/* /help/* /mozapps/* /contents.rdf /install.rdf /icon.png /preview.png
Make sure not to just zip up the My_Theme
parent directory since that will cause the drag and drop install in the next section to fail without error messages. Once you have put the files in the zip folder, rename it to My_Theme.jar
Triggering the install from the web
To install the theme's JAR file directly from the web, you need to run some JavaScript.
<a href='javascript:InstallTrigger.installChrome(InstallTrigger.SKIN, "myskin.jar", "My Skin Theme")'>install My Skin</a>
If you have JAR files on your hard drive and would like to install them, then download/use this form.
You can also just open the themes window in Mozilla and drag and drop your .jar file onto it.
Now to change your folder(s) back into a .jar Well it's easy! What you do is put your folder(s) into a .zip file and then when it's compressed make the .zip into a .jar