Horizon uses SCSS (not to be confused with Sass) to style its HTML. This guide is targeted at developers adding code to upstream Horizon. For information on creating your own branding/theming, see Customizing Horizon.
The base SCSS can be found at openstack_dashboard/static/dashboard/scss/. This directory should only contain the minimal styling for functionality code that isn’t configurable by themes. horizon.scss is a top level file that imports from the components/ directory, as well as other base styling files; potentially some basic page layout rules that Horizon relies on to function.
Note
Currently, a great deal of theming is also kept in the horizon.scss file in this directory, but that will be reduced as we proceed with the new code design.
Horizon’s default theme stylesheets can be found at openstack_dashboard/themes/default/.
├── _styles.scss
├── _variables.scss
├── bootstrap/
└── ...
└── horizon/
└── ...
The top level _styles.scss and _variables.scss contain imports from the bootstrap and horizon directories.
This directory contains overrides and customization of Bootstrap variables, and markup used by Bootstrap components. This should only override existing Bootstrap content. For examples of these components, see the Theme Preview Page.
bootstrap/
├── _styles.scss
├── _variables.scss
└── components/
├── _component_0.scss
├── _component_1.scss
└── ...
This directory contains SCSS that is absolutely specific to Horizon; code here should not override existing Bootstrap content, such as variables and rules.
horizon/
├── _styles.scss
├── _variables.scss
└── components/
├── _component_0.scss
├── _component_1.scss
└── ...
To keep Horizon easily themable, there are several code design guidelines that should be adhered to:
When the DEBUG setting is set to True, the Developer dashboard will be present in Horizon’s side nav. The Bootstrap Theme Preview panel contains examples of all stock Bootstrap markup with the currently applied theme, as well as source code for replicating them; click the </> symbol when hovering over a component.
A second theme is provided by default at openstack_dashboard/themes/material/. When adding new SCSS to horizon, you should check that it does not interfere with the Material theme. Images of how the Material theme should look can be found at https://bootswatch.com/paper/. This theme is now configured to run as the alternate theme within Horizon.