Extension:Theme (Fork)
Release status: stable |
|
|---|---|
| Implementation | Skin |
| Description | Allows using themes of skins |
| Author(s) | WikiMANNia (WikiForMen) |
| Latest version | 3.7 (2026-11-23) |
| Compatibility policy | Master maintains backward compatibility. |
| MediaWiki | 1.35+ |
| Database changes | No |
|
$wgDefaultThemes, $wgDisableSelectThemes, $wgSkipThemes, $wgFallbackTheme |
|
| Licence | Public domain |
| Download | |
| Example | ShoutWiki |
The Theme extension allows loading of themes (preset CSS to change the appearance of a skin).
Users can determine their preferred theme by configuring this in their preferences.
The $wgDefaultThemes variable can be used to control what theme is being used site-wide, and the usetheme=X parameter is accepted on a request to change the theme on a per-pageload basis.
This extension was initially written by Skizzerz for ShoutWiki and then further developed by WikiForMen for WikiMANNia. This fork is based on version 2.5.1 of the original.
Installation
[edit source]- Download and move the extracted
Themefolder to yourextensions/directory. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'Theme' );
Done – Navigate to Special:Versionon your wiki to verify that the extension is successfully installed.
Parameters
[edit source]$wgDefaultSkin
[edit source]$wgDefaultSkin– controls which skin is displayed by default when users visit your wiki.
$wgDefaultThemes
[edit source]$wgDefaultThemes– controls which theme is displayed by default when users visit your wiki.
$wgDefaultThemes = [
'skinname1' => 'themename1',
'skinname2' => 'themename2',
'skinname3' => 'default'
];
The variable $wgDefaultTheme is deprecated. It is still maintained for backward compatibility and used as a fallback solution, if $wgDefaultThemes['skinname'] is not set.
$wgSkipThemes
[edit source]$wgSkipThemes– (available from extension version 2.5, July 2024) allows sysadmins to disable certain themes. If you wanted to disable the 'StellarBook' theme in skin MonoBook and the 'dark' theme from skin Vector, for example, you'd set it like so:
$wgSkipThemes = [
'cologneblue' => [
'partybook' => false
],
'monobook' => [
'stellarbook' => true
],
'vector' => [
'dark' => true
]
];
$wgDisableSelectThemes
[edit source]$wgDisableSelectThemes– (available from extension version 3.4, Nov 2026) allows sysadmins to disable theme selection for specific skins. Using this feature will fix the settings$wgDefaultSkin = 'skinname';and$wgDefaultThemes['skinname'] = 'themename';and prevent the user from changing them in their personal settings. To exclude skins 1 and 2 from the theme selection, for example, proceed as follows:
$wgDisableSelectThemes = [
'skinname1' => true,
'skinname2' => true,
'skinname3' => false
];
$wgFallbackTheme
[edit source]$wgFallbackTheme– It serves as a fallback if$wgDefaultThemesis not set for a particular theme or if the theme is mistakenly included in the$wgSkipThemeslist.
Available themes
[edit source]Certain skins, like Bouquet, Dusk or Gamepress include themes as a part of the skin; themes can then be activated once the Theme extension is installed on your wiki.
Other skins, primarily those maintained by Wikimedia Foundation developers for use on Wikimedia Foundation websites like Wikipedia etc., do not include themes; instead their themes are located as a part of the Theme extension. Currently these kind of skins include Cologne Blue, MonoBook, and Vector.
As a part of the Theme extension
[edit source]- For Cologne Blue
- partybook (new in version 3.3)
- For MonoBook
- dark
- pink
- stellarbook
- wipi (new in version 3.1)
- For Vector (2010)
- dark
- dark-grey
- deepsea (removed in version 2.3, restored in version 3.2)
Included with the skins themselves
[edit source]- blackrose (new in version 2.5)
- forgetmenot
- pinkdogwood
- tigerlily
- green
- red (default)
- blue
- green
- orange
Adding themes
[edit source]To add a new theme for a core skin (such as Modern or Vector), create a directory called skinname (i.e. vector) under $IP/extensions/Theme, place the CSS file(s) there and register the new theme in Theme/extension.json file, under ResourceModules object.
To add a new theme for a custom skin, register a module for each theme in the skin's main setup file (skin.json).
The naming convention is themeloader.skins.skinname-in-lowercase.themename-in-lowercase; for example, the module name of the AutumnLeaf theme for the BlueCloud skin would be themeloader.skins.bluecloud.autumnleaf.
You also need to define the key below to list the available theme names. Here's how Gamepress does that (see Gamepress' skin.json file's master version for details):
attributes.Theme.Modulesin manifest version 2ThemeModulesin manifest version 1
| manifest version 2 | manifest version 1 |
|---|---|
{
"attributes": {
"Theme": {
"Modules": [
"gamepress": [
"blue",
"green",
"orange"
]
]
}
}
}
|
{
"ThemeModules": {
"gamepress": [
"blue",
"green",
"orange"
]
}
}
|
License
[edit source]The main PHP file is PD-licensed, while some of the actual theme files may not be.
