Use LESS Variables

Last modified by Eleni Cojocariu on 2026/02/05 17:21

Content

Steps

1. Find the property you want to use.

XWiki Standard has its LESS variables declared in a few files, mostly:

  • variables.less from the bootstrap module: pretty much everything to make the Bootstrap 3 design system work.
  • variables.less from the flamingo module: XWiki's special variables and overrides for default values
  • variablesInit.vm from the flamingo module:
  • $xsVariablesValues in variablelist.vm 
  • The flamingo Color Themes, those variables can be viewed and edited directly in the Administrator UI but they do not cover everything in the skin.
Information

LESS variables can also be declared in any of your custom LESS stylesheets. If you can't find it in the xwiki-platform codebase, it's probably from a customization emoticon_smile

2. Use this syntax in a LESS stylesheet

.box.box-custom {
  color: @brand-color;
}

FAQ

Can I use a LESS variable in a CSS stylesheet?

Technically this is impossible. Use a CSS property instead. In the rare case where you NEED a CSS stylesheet and cannot use CSS properties, rely instead on the old Colortheme variables.

Get Connected