Creating a Skin for Firefox/Getting Started

Перевод не завершен. Пожалуйста, помогите перевести эту статью с английского.

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 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.


Inside classic.jar is one directory, skin, as well as two files, preview.png and icon.png.

skin simply contains another directory, classic which holds all the good stuff.
classic contains the following directories.
browser contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window.
Doesn't do a whole lot and can typically be forgotten about promptly.
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.
help contains all the files for theming the help dialog window.
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

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.


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">

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:

      <!-- Firefox's UUID -->

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:


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


Метки документа и участники

 Внесли вклад в эту страницу: archer495
 Обновлялась последний раз: archer495,