www/customskin.md
Skinning the Fossil Web Interface
The Fossil web interface comes with a pre-configured look and feel. The default look and feel works fine in many situations. However, you may want to change the look and feel (the "skin") of Fossil to better suite your own individual tastes. This document provides background information to aid you in that task.
Built-in Skins
Fossil comes with multiple built-in skins. If the default skin does not suite your tastes, perhaps one of the other built-in skins will work better. If nothing else, the built-in skins can serve as examples or templates that you can use to develop your own custom skin.
The sources to these built-ins can be found in the Fossil source tree under the skins/ folder. The skins/ folder contains a separate subfolder for each built-in skin, with each subfolders holding at least these five files:
- css.txt
- details.txt
- footer.txt
- header.txt
- js.txt
Try out the built-in skins by using the --skin option on the fossil ui or fossil server commands.
Sharing Skins
The skin of a repository is not part of the versioned state and does not "push" or "pull" like checked-in files. The skin is local to the repository. However, skins can be shared between repositories using the fossil config command. The "fossil config push skin" command will send the local skin to a remote repository and the "fossil config pull skin" command will import a skin from a remote repository. The "fossil config export skin FILENAME" will export the skin for a repository into a file FILENAME. This file can then be imported into a different repository using the "fossil config import FILENAME" command. Unlike "push" and "pull", the "export" and "import" commands are able to move skins between repositories for different projects. So, for example, if you have a group of related repositories, you can develop a skin for one of them, then get a consistent look across all the repositories by exporting the skin from the first repository and importing into all the others.
The file generated by "fossil config export" could be checked into one of your repositories and versioned, if desired. This will not automatically change the skin when looking backwards in time, but it will provide an historical record of what the skin used to be and allow the historical look of the repositories to be recreated if necessary.
When cloning a repository, the skin of the new repository is initialized to the skin of the repository from which it was cloned.
Structure Of A Fossil Web Page
Every HTML page generated by Fossil has the same basic structure:
| Fossil-Generated HTML Header | | Skin Header | | Fossil-Generated Content | | Skin Footer | | Fossil-Generated HTML Footer |
By default, Fossil starts every generated HTML page with this:
<html>
<head>
<base href="...">
<meta http-equiv="Content-Security-Policy" content="....">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>....</title>
<link rel="stylesheet" href="..." type="text/css">
</head>
<body class="FEATURE">
Fossil used to require a static version of this in every skin’s Header area, but over time, we have found good cause to generate multiple elements at runtime.
One such is the FEATURE element, being either the top-level HTTP
request routing element (e.g. doc) or an aggregate feature class that
groups multiple routes under a single name. A prime example is forum,
which groups the /forummain, /forumpost, and /forume2 routes,
allowing per-feature CSS. For instance, to style <blockquote> tags
specially for forum posts written in Markdown, leaving all other block
quotes alone, you could say:
body.forum div.markdown blockquote {
margin-left: 10px;
}
You can override this generated HTML header by including a
“<body>” tag somewhere in the Header area of the skin, but it is
almost always best to limit a custom skin’s Header section to something
like this: