dev

ThemeColorClasses is a CSS stylesheet that allows using the wiki's theme colors in page content.

Each wiki has its own set of colors, which is subject to changes via Theme Designer and also differs between light mode and dark mode. The colors are already exposed via a set of CSS variables/custom properties, but this stylesheet makes it easier to use them via dedicated class names.

In addition, the stylesheet offers a method to set free colors based on theme via the page's source code.

Installation

Usage

There are many different variables and therefore many related classes, but there is some sense behind them. Some of the colors are set directly via Theme Designer, while others are picked automatically by Fandom. Below is a list of the available colors, without the class names which are listed later:

The desired color is applied by specifying the correct class name on the element, see the code examples below.

Class names

Below is a list of the available class names. Some of the classes have an optional mode that changes the color slightly when the element is hovered over. This is turned on by adding the class with-hover besides the color class.

The list is also a live demo. If DemoScripts is enabled on your account (should be by default), each list item would also show it's associated color according to this wiki's theme. Switch between light and dark theme to see the colors change, and hover over the with-hover part to see the hover effect.

Notes

Examples

<div class="theme-page-secondary" style="padding: 1em;">
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.
</div>

Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.

<span class="theme-alert-text">Lorem ipsum</span> dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.

Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.

<div class="theme-accent with-hover">
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.
</div>

Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.

<div class="theme-body theme-page-text">
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.
</div>

Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.

<div class="theme-border" style="border-style: dashed; border-width: 10px;">
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.
</div>

Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.

<div class="theme-page-secondary theme-border" style="alpha: 70%; padding: 1em;">
<span style="font-size: 150%;">Lorem Ipsum</span><div class="theme-alert" style="height: 3px;">&nbsp;</div>
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.
</div>
Lorem Ipsum
 

Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.

Custom theme-based colors

The classes above allow applying theme-based colors out of the wiki's predefined pallete. However, sometimes wikis want to use custom colors in certain places (like colorful templates or tables), and still want different colors for each theme. This can be done by using the special class theme-custom, and setting the colors via custom properties. The custom properties are:

Here is an example of how to use it:

<div class="theme-custom" style="--background-dark: darkblue; --background-light: lightblue; --border-color-light: lime; --color-dark: yellow; --color-light: purple;">
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.
</div>

Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua.

If a certain value is missing, the background defaults to no color (transparent), the text color to the wiki's page text color, and the border color to match the text color. However, no actual border is added by default. Use border-width: and border-style: to add it.

See also

Text above can be found here (edit)