Extension:Theme
![]() Release status: stable |
|
---|---|
Implementation | Skin |
Description | Allows using themes of skins |
Author(s) | Ryan Schmidt Jack Phoenix Samantha Nguyen |
Latest version | 2.3 |
MediaWiki | 1.39+ |
License | Public domain (the main PHP file is PD-licensed, while some of the actual theme files may not be) |
Download | |
Example | ShoutWiki |
$wgDefaultTheme |
|
Quarterly downloads | 36 (Ranked 120th) |
Public wikis using | 1,212 (Ranked 229th) |
Translate the Theme extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
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 $wgDefaultTheme
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.
Installation edit
- Download and place the file(s) in a directory called
Theme
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'Theme' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Parameters edit
$wgDefaultTheme controls which theme is displayed by default when users visit your wiki.
Available themes edit
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 MonoBook and Vector.
As a part of the Theme extension edit
- For MonoBook
- dark
- pink
- stellarbook
- For Vector
- dark
- dark-grey
deepsea(removed for MW 1.39+ in 06bbbfd597df7b63206f7eaf95a120a42583d03d)
Included with the skins themselves edit
- forgetmenot
- pinkdogwood
- tigerlily
- green
- red (default)
- blue
- green
- orange
Adding themes edit
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 a top-level key called ThemeModules
to list the available theme names. Here's how Gamepress does that (see Gamepress' skin.json file's master version for details):
"ThemeModules": {
"gamepress": [ "blue", "green", "orange" ]
},
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |