Customizing Citizen styles - StarCitizenTools/mediawiki-skins-Citizen GitHub Wiki

This page is about how you can customize Citizen styles on your wiki.

Click here for information on how to adapt Citizen styles on your wiki.

Quick start

  1. If you don't know how to write CSS and use Dev Tools, it is highly recommended to learn those to make your time much easier! Guide on DevTools
  2. Set $wgAllowSiteCSSOnRestrictedPages to true to allow site styles to work on some special pages (e.g. Special:UserLogin).
  3. Try changing --color-progressive-oklch__h to a different value in MediaWiki:Citizen.css on your wiki:
:root {
    /* Pink is the new black */
    --color-progressive-oklch__h: 350;
    /* Optional: HSL fallback for browser that does not support OKLCH */
    --color-progressive-hsl__h: 320;
}

Changing color scheme

Citizen uses CSS variables to control the color scheme of the UI.

It is recommended to use Citizen CSS variables directly because they are adapted to the current theme.

Supported extensions use the same variables. Please feel free to open an issue or submit a PR if you want to add new support.

Primary color

Citizen uses the OKLCH syntax for primary color to calculate right colors for different themes, including surface colors, text colors, etc. For browser that does not support OKLCH, it will fallback to HSL colors.

Primary colors are then apply throughout all UI elements, including all supported extensions through skinStyles.

By default, Citizen uses the Codex default progressive color: #36c

To change your primary color, simply convert your desired color to OKLCH to set the following variables:

Property Description Default value
--color-progressive-oklch__h Hue of primary color, this will affect other text and surface colors 262.29
--color-progressive-oklch__c Chroma of primary color in light mode 0.1679
--color-progressive-oklch__l Lightness of primary color in light mode 53.25%

Themes

You can use these class to define custom styles for each theme.

For more detailed usage on defining specific styles for each theme, see the guide for adapting dark mode on MediaWiki.

Class Description
.skin-theme-clientpref-light Light theme
.skin-theme-clientpref-night Dark theme
.skin-theme-clientpref-os Auto theme

Surface color

Property Description
--color-surface-0 Site background only (e.g. surface that has the same color as site background)
--color-surface-1 Surface background 1 (e.g. modal, dropdown) (this has the same color as site background (#fff) in light mode)
--color-surface-2 Surface background 2
--color-surface-3 Surface background 3
--color-surface-4 Surface background 4

Text color

Property Description
--color-base Base text color (e.g. body text)
--color-emphasized Emphasized text color (e.g. title)
--color-subtle Subtle text color (e.g. caption)

Examples

To customize light theme colors, you can:

/* Make light theme great again */
:root.skin-theme-clientpref-day {
    --color-surface-0: red;
    --color-surface-1: lime;
    --color-surface-2: fuchsia;
    --color-surface-3: yellow;
    --color-surface-4: aqua;
    --color-base: blue;
    --color-base--emphasized: darkblue;
    --color-base--subtle: cornflowerblue;
}

To customize dark theme colors, you can:

/* Blackpink in your area */
:root.skin-theme-clientpref-night {
    --color-surface-0: black;
    --color-surface-1: black;
    --color-surface-2: black;
    --color-surface-3: black;
    --color-surface-4: black;
    --color-base: pink;
    --color-base--emphasized: pink;
    --color-base--subtle: pink;
}

/* Automatic mode */
@media screen and (prefers-color-scheme: dark) {
    :root.skin-theme-clientpref-os {
        --color-surface-0: black;
        --color-surface-1: black;
        --color-surface-2: black;
        --color-surface-3: black;
        --color-surface-4: black;
        --color-base: pink;
        --color-base--emphasized: pink;
        --color-base--subtle: pink;
    }
}

Note that you will need to set automatic mode in addition of the night mode color.

Changing fonts

Citizen uses CSS variable to define fonts used through the skin and extension styles.

You can change the default fonts by simply redefining the CSS variables.

Since Citizen uses variable fonts heavily, it is recommended to use a variable font for replacement so the font styles are preserved.

Property Description Default value
--font-family-citizen-base Default fonts, used in most places 'Roboto'
--font-family-citizen-serif Serif fonts, used in blockquotes and some cases 'Roboto Serif'
--font-family-citizen-monospace Monospace fonts, used in editors and code blocks 'Roboto Mono'

Examples

To change the base font to the best font aka Comic Sans MS, you can:

/* Bless the wiki with the pinnacle of typography */
:root {
    --font-family-citizen-base: 'Comic Sans MS';
}

Changing page width

Citizen uses CSS variable --width-layout to define page content width. You can redefine the variable on either the html or the body element.

Option Selector Default value
Standard :root.citizen-feature-custom-width-clientpref-standard 1080px
Wide :root.citizen-feature-custom-width-clientpref-wide 1600px
Full :root.citizen-feature-custom-width-clientpref-full 100vw

Examples

To change the page width on the WasabiMayo page, you can:

/* Make WasabiMayo full-width */
.page-WasabiMayo {
    --width-layout: 100vw;
}