S2 Guide: Style System Overview
Contents
Layers
<graphviz caption='Order of layers'> digraph layers { rankdir = "LR";
core_layer [shape="doubleoctagon" color="#002F74" fontcolor="black" label="Core"]; i18nc_layer [shape="Mdiamond" color="#017313" fontcolor="black" label="i18nc"]; layout_layer [shape="doubleoctagon" color="#444F96" fontcolor="black" label="Layout"]; i18n_layer [shape="Mdiamond" color="#01A313" fontcolor="black" label="i18n"]; theme_layer [shape="doubleoctagon" color="#886FA8" fontcolor="black" label="Theme"]; wizard_layer [shape="doubleoctagon" color="#BB8FCA" fontcolor="black" label="Wizard"];
subgraph {
rank = same; core_layer; i18nc_layer;
}
subgraph {
rank = same; layout_layer; i18n_layer;
}
core_layer -> layout_layer i18nc_layer -> core_layer layout_layer -> theme_layer i18n_layer -> layout_layer theme_layer -> wizard_layer } </graphviz>
Core layer
The core layer is the foundation everything else builds on. It can:
- Define classes
- Define builtin functions that are present in the backend
- Define global functions that don't belong to a class
- Define class methods
- Define and set properties
Dreamwidth has two different core layers.
- core1 is inherited from LiveJournal and allows people to import their LiveJournal layouts.
- core2 is Dreamwidth's core layer, that includes extra features built in, like modules. Plain Tabula Rasa is the base style put out by core2 without any modifications.
Layout layer
- Define builtin functions that are present in the backend
- Define global functions that don't belong to a class
- Define class methods; the method name must have the prefix lay_ to avoid future namespace collisions if the core layer expands
- Define and set properties
- Set up properties for the customization wizard
Theme layer
A theme layer can:
- Override existing functions
- Override names and descriptions of properties
It's usually used to make different versions to a base layout, such as different color schemes.
Wizard layer
All a wizard layer can do is set existing properties. Since a lot of layouts have many properties, this can change a lot of things!
It's meant to be edited using the customize interface on the site, but can also be created or edited manually. (If you're familiar with styles on LiveJournal, this was called the "user layer".)
Many new layout themes have originated from people sharing wizard layers in dreamscapes!
Internationalization layers
Unless you're translating a layout into another language, you won't have to worry about these layers. The i18nc layer overrides text properties in the core, translating them into a specific language. It also overrides the default short, medium, and long date and time formats and functions which do things like return ordinal numbers from cardinal numbers and map item counts onto their plural form.
To achieve this goal, language layers can:
- Set properties
- Override the names and descriptions of properties
- Override existing functions
i18nc: core
This layer translates text properties in the core into a specific language, overrides the default date and time formats, and changes functions that do things like make pluralized item count statements--all things that can change according to different languages or standard conventions!
i18n: layout
This layer does the same as i18nc, but only for new properties or functions added by a layout.