Skip to content

Using Citizen styles

alistair3149 edited this page Jul 17, 2024 · 3 revisions

This page is about how you can use Citizen styles on your wiki pages and templates.

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

Applying Citizen styles in templates

There are multiple ways to apply Citizen styles in your wiki's templates through CSS variables:

  1. Extension:TemplateStyles, you will also need Extension:TemplateStylesExtender to use CSS variables
  2. Extension:CSS
  3. MediaWiki:Citizen.css on your wiki

Helpful classes

  • .skin-citizen-{THEME NAME} - use to target specific themes. (e.g. .skin-citizen-dark for dark theme)
  • .floatright - responsive float right, commonly used in templates like infobox.
  • .floatleft - responsive float left.
  • .floatnone - clear both sides.
  • .citizen-overflow - wrap content in a container and add overflow handling
  • .citizen-table-nowrap - disable table wrapper on the current table or its direct children

Common conversions

Colors

Accent

Name Description WMUI equivalent
--color-progressive Primary color #36c #36c
--color-destructive Destructive color #d33 #d33
--color-success Success color #00af89 #00af89
--color-warning Warning color #fc3 #fc3

Border

Use the following rule, you might have to specify which border (e.g. border-top-color for border-top)

border-color: var( --border-color-base );

Surface

Name Description WMUI equivalent
--color-surface-0 Site background only #fff #fff
--color-surface-1 Surface background 1 (This is not the same as background 0) #fff #fff
--color-surface-2 Surface background 2 #f8f9fa #f8f9fa
--color-surface-3 Surface background 3 #eaecf0 #eaecf0
--color-surface-4 Surface background 4 #c8ccd1 #c8ccd1, #a2a9b1 #a2a9b1

Shadow

Name Description WMUI equivalent
--box-shadow-card Card shadow @box-shadow-card
--box-shadow-dialog Dialog shadow @box-shadow-dialog

Text

Name Description WMUI equivalent
--color-emphasized Emphasized text color for title text #000 #000
--color-base Base text color for body text #202122 #202122
--color-subtle Subtle text color for caption text #54595d #54595d, #72777d #72777d

Icons

Patching icon color in dark theme

Icons might need to be "flipped" to be visible in dark theme. Simply add the following rule to the direct element that contains the icon:

filter: var( --filter-invert );