1c2f8f34eSDerick Montague# Theme customization 2*7385e139SPatrick Williams 3c2f8f34eSDerick MontagueCustomization of the application requires knowledge of Sass and CSS. It also 4c2f8f34eSDerick Montaguewill require becoming familiar with the Bootstrap and Bootstrap-Vue component 5c2f8f34eSDerick Montaguelibraries. This section outlines the global options and variables that can be 6c2f8f34eSDerick Montagueremoved or updated to meet organizational brand guidelines. 7c2f8f34eSDerick Montague 8c2f8f34eSDerick Montague## Environment specific builds 9*7385e139SPatrick Williams 10c2f8f34eSDerick MontagueAny organization can create a build that meets their branding and other 11c2f8f34eSDerick Montaguecustomization needs. This includes customization of the state store, routing, 12c2f8f34eSDerick Montagueapplication navigation, and theming. 13c2f8f34eSDerick Montague 14c2f8f34eSDerick Montague[Read more in the Build Customization section](/customization/build) 15c2f8f34eSDerick Montague 16c2f8f34eSDerick Montague### Configuring environment specific builds 17*7385e139SPatrick Williams 18c2f8f34eSDerick MontagueThe complete instructions can be found in the `env` directory in a file called 19*7385e139SPatrick Williamsenv.md or by viewing the 20*7385e139SPatrick Williams[Configuring environment specific builds page](./env.md) 21c2f8f34eSDerick Montague 22c2f8f34eSDerick Montague## Bootstrap Sass Options 23*7385e139SPatrick Williams 24c2f8f34eSDerick MontagueThe Bootstrap Sass options are global styling toggles. The naming convention for 25c2f8f34eSDerick Montaguethese built-in variables is `enabled-*`. 26c2f8f34eSDerick Montague 27c2f8f34eSDerick Montague### $enable-rounded 28*7385e139SPatrick Williams 29c2f8f34eSDerick MontagueThis option enables or disables the border-radius styles on various components. 30c2f8f34eSDerick Montague 31c2f8f34eSDerick Montague- Set to `false` to remove rounded corners on all container elements and buttons 32c2f8f34eSDerick Montague 33c2f8f34eSDerick Montague### $enable-validation-icons 34*7385e139SPatrick Williams 35c2f8f34eSDerick MontagueThis option enables or disables background-image icons within textual inputs and 36c2f8f34eSDerick Montaguesome custom forms for validation states. 37c2f8f34eSDerick Montague 38c2f8f34eSDerick Montague- Set to `false` due to inability to style icons using CSS 39c2f8f34eSDerick Montague 40c2f8f34eSDerick Montague### More information 41*7385e139SPatrick Williams 42*7385e139SPatrick Williams- [View all the Bootstrap Sass Options](https://getbootstrap.com/docs/4.2/getting-started/theming/#sass-options) 43c2f8f34eSDerick Montague 44c2f8f34eSDerick Montague## Bootstrap Sass Variables 45*7385e139SPatrick Williams 46c2f8f34eSDerick MontagueThese are global variables that Bootstrap defines in the 47c2f8f34eSDerick Montague`/node_modules/bootstrap/scss/variables.scss` helper file. Adding a variable 48c2f8f34eSDerick Montaguelisted in this file to the `/src/assets/styles/bmc/helpers/_variables.scss` file 49c2f8f34eSDerick Montaguewill override the Bootstrap defined value. 50c2f8f34eSDerick Montague 51c2f8f34eSDerick Montague### $transition-base 52*7385e139SPatrick Williams 53c2f8f34eSDerick MontagueThis variable sets the base CSS transition style throughout the application. 54*7385e139SPatrick Williams 55c2f8f34eSDerick Montague- Set to `all $duration--moderate-02 $standard-easing--productive` 56c2f8f34eSDerick Montague 57c2f8f34eSDerick Montague### $transition-fade 58*7385e139SPatrick Williams 59c2f8f34eSDerick MontagueThis variable sets the transition when showing and hiding elements. 60c2f8f34eSDerick Montague 61c2f8f34eSDerick Montague- Set to `opacity $duration--moderate-01 $standard-easing--productive` 62c2f8f34eSDerick Montague 63c2f8f34eSDerick Montague### $transition-collapse 64*7385e139SPatrick Williams 65c2f8f34eSDerick MontagueThis variable sets the CSS transitions throughout the application when expanding 66c2f8f34eSDerick Montagueand collapsing elements. 67c2f8f34eSDerick Montague 68c2f8f34eSDerick Montague- Set to `height $duration--slow-01 $standard-easing--expressive` 69c2f8f34eSDerick Montague 70c2f8f34eSDerick Montague### More Information 71*7385e139SPatrick Williams 72*7385e139SPatrick Williams- [Carbon Design System Motion Guidelines](https://www.carbondesignsystem.com/guidelines/motion/basics/) 73*7385e139SPatrick Williams- [Including Animation In Your Design System](https://www.smashingmagazine.com/2019/02/animation-design-system/) 74c2f8f34eSDerick Montague 75c2f8f34eSDerick Montague## OpenBMC Custom Sass Options 76c2f8f34eSDerick Montague 77c2f8f34eSDerick Montague### $responsive-layout-bp 78*7385e139SPatrick Williams 79c2f8f34eSDerick MontagueThis variable determines when the primary navigation is hidden and when the 80c2f8f34eSDerick Montaguehamburger menu is displayed. The breakpoint is defined using a Bootstrap 81c2f8f34eSDerick Montaguefunction that only accepts a key from the Bootstrap `$grid-breakpoints` map. 82c2f8f34eSDerick Montague 83c2f8f34eSDerick Montague- xs - Navigation is always displayed 84c2f8f34eSDerick Montague- sm - Navigation displayed when the viewport is greater than 576px 85c2f8f34eSDerick Montague- md - Navigation displayed when the viewport is greater than 768px 86c2f8f34eSDerick Montague- lg - Navigation displayed when the viewport is greater than 992px 87c2f8f34eSDerick Montague- xl - Navigation displayed when the viewport is less than 1200px 88c2f8f34eSDerick Montague 89c2f8f34eSDerick Montague#### Responsive Resources 90*7385e139SPatrick Williams 91*7385e139SPatrick Williams- [Bootstrap responsive breakpoints](https://getbootstrap.com/docs/4.0/layout/overview/#responsive-breakpoints) 92*7385e139SPatrick Williams- [Bootstrap Sass Mixins](https://getbootstrap.com/docs/4.0/layout/overview/#responsive-breakpoints) 93*7385e139SPatrick Williams- [Customizing the Bootstrap Grid](https://getbootstrap.com/docs/4.0/layout/overview/#responsive-breakpoints) 94c2f8f34eSDerick Montague 95c2f8f34eSDerick Montague### $header-height 96*7385e139SPatrick Williams 97c2f8f34eSDerick MontagueThis variable determines the height of the OpenBMC Web UI header element. 98c2f8f34eSDerick Montague 99c2f8f34eSDerick Montague- Default value: 56px 100c2f8f34eSDerick Montague 101c2f8f34eSDerick Montague### $navigation-width 102*7385e139SPatrick Williams 103c2f8f34eSDerick MontagueThis variable determines the width of the primary navigation menu when expanded. 104c2f8f34eSDerick Montague 105c2f8f34eSDerick Montague- Default value: 300px 106c2f8f34eSDerick Montague 107c2f8f34eSDerick Montague### $container-bgd 108*7385e139SPatrick Williams 109c2f8f34eSDerick MontagueThis option sets the background of page containers. Changing the value of this 110c2f8f34eSDerick Montaguevariable will change the background color for the following elements: 111*7385e139SPatrick Williams 112c2f8f34eSDerick Montague- Login page 113c2f8f34eSDerick Montague- Primary navigation section 114c2f8f34eSDerick Montague- Quick links section on the overview page 115c2f8f34eSDerick Montague 116c2f8f34eSDerick Montague#### Value 117*7385e139SPatrick Williams 118c2f8f34eSDerick Montague- Default value: $gray-200 119c2f8f34eSDerick Montague 120c2f8f34eSDerick Montague### $primary-nav-hover 121*7385e139SPatrick Williams 122c2f8f34eSDerick MontagueThe semantic naming of this variable identifies its purpose. This color should 123c2f8f34eSDerick Montaguealways be slightly darker than the `$container-bgd` value. 124c2f8f34eSDerick Montague 125c2f8f34eSDerick Montague- Default value: $gray-300 126c2f8f34eSDerick Montague 127c2f8f34eSDerick Montague## Updating Colors 128*7385e139SPatrick Williams 129c2f8f34eSDerick MontagueSupporting a different color palette is a simple process. The default color 130c2f8f34eSDerick Montaguepalette is supported using the Sass variables outlined in the color guidelines 131c2f8f34eSDerick Montagueand color maps outlined in the theme's overview. The following sections provide 132c2f8f34eSDerick Montaguedirections to update the settings to meet your organization's needs. 133c2f8f34eSDerick Montague 134c2f8f34eSDerick Montague### Color 135*7385e139SPatrick Williams 136c2f8f34eSDerick MontagueThe OpenBMC Web UI uses Sass variables and maps to build its layout and 137c2f8f34eSDerick Montaguecomponents. Bootstrap variables and maps use the `!default` flag to allow for 138c2f8f34eSDerick Montagueoverrides. There are three Sass maps created to establish the color palette. 139c2f8f34eSDerick MontagueThese include the `color` map, `theme-color` map, and `gray` map. These maps are 140c2f8f34eSDerick Montagueused by Bootstrap to build the application's CSS stylesheets. 141c2f8f34eSDerick Montague 142c2f8f34eSDerick Montague#### All Colors 143*7385e139SPatrick Williams 144c2f8f34eSDerick MontagueThe OpenBMC Web UI custom colors are available as Sass variables and a Sass map 145c2f8f34eSDerick Montaguein `/src/assets/styles/bmc/helpers/_variables.scss`. The OpenBMC theme only 146c2f8f34eSDerick Montaguerequires a subset of the colors to create the look and feel of the application. 147c2f8f34eSDerick MontagueAdding, removing, or updating the color variables and map is how the application 148c2f8f34eSDerick Montaguecolor palette can be customized. Using these variables outside of the helper 149c2f8f34eSDerick Montaguefiles is discouraged to avoid tightly coupling the OpenBMC Web UI theme to 150c2f8f34eSDerick Montaguespecific colors. 151c2f8f34eSDerick Montague 152c2f8f34eSDerick MontagueThe `color` map is not as important as the `theme-color` map. A tight-coupling 153c2f8f34eSDerick Montagueof the Sass variable name to the color name makes it hard to use the `color` map 154c2f8f34eSDerick Montaguekeys for customization. Using these keys in Sass stylesheets or single-file 155c2f8f34eSDerick Montaguecomponents is discouraged. 156c2f8f34eSDerick Montague 157c2f8f34eSDerick Montague#### Theme Colors 158*7385e139SPatrick Williams 159c2f8f34eSDerick MontagueThe theme color variables and the `theme-color` map consist of a subset of the 160c2f8f34eSDerick Montaguecolor variables. This smaller color palette creates a scheme that is not 161c2f8f34eSDerick Montaguedependent on specific colors like blue or green. Several of the Bootstrap 162c2f8f34eSDerick Montague`theme-color` map keys are required to generate the CSS styles. The OpenBMC Web 163c2f8f34eSDerick MontagueUI `theme-color` map has the same keys as the Bootstrap `theme-color` map with 164c2f8f34eSDerick Montaguecustom values. 165c2f8f34eSDerick Montague 166c2f8f34eSDerick MontagueThe `theme-color` map is used heavily throughout the application. The 167c2f8f34eSDerick MontagueBootstrap-Vue components `variant` prop also utilizes the `theme-color` map. 168c2f8f34eSDerick MontagueThis map is the key to customizing the application's color palette. Take a look 169c2f8f34eSDerick Montagueat the [color guidelines](/guide/guidelines/colors) to better understand default 170c2f8f34eSDerick Montaguetheme-colors map. 171c2f8f34eSDerick Montague 172c2f8f34eSDerick Montague#### Gray Colors 173*7385e139SPatrick Williams 174c2f8f34eSDerick MontagueThe gray color palette contains nine shades of gray that range from light to 175c2f8f34eSDerick Montaguedark. Bootstrap sets a default gray color value for each color variable from 176c2f8f34eSDerick Montague100-900 in increments of one hundred, for example, `$gray-100`, `$gray-200`, 177c2f8f34eSDerick Montague`$gray-300` through `gray-900`. Bootstrap does not create a color map for any of 178c2f8f34eSDerick Montaguethe colors except gray. The Bootstrap documentation indicates that adding color 179c2f8f34eSDerick Montaguemaps for all the default colors is scheduled to be delivered in a future patch. 180c2f8f34eSDerick MontagueThe OpenBMC Web UI color theme overrides all shades of the Bootstrap default 181c2f8f34eSDerick Montaguegray variable values. 182c2f8f34eSDerick Montague 183*7385e139SPatrick Williams[Learn more about Bootstrap colors](https://getbootstrap.com/docs/4.0/getting-started/theming/#color) 184c2f8f34eSDerick Montague 185c2f8f34eSDerick Montague### Bootstrap Color Functions 186*7385e139SPatrick Williams 187c2f8f34eSDerick Montague- `color('<color map key>)` 188c2f8f34eSDerick Montague- `theme-color('<theme color map key>)` 189c2f8f34eSDerick Montague- `gray('<gray color palette key'>)` 190c2f8f34eSDerick Montague 191c2f8f34eSDerick Montague#### Example 192*7385e139SPatrick Williams 193c2f8f34eSDerick Montague```SCSS 194c2f8f34eSDerick Montague.some-selector { 195c2f8f34eSDerick Montague color: color("blue"); 196c2f8f34eSDerick Montague background: theme-color("light"); 197c2f8f34eSDerick Montague border: 1px solid gray("900") 198c2f8f34eSDerick Montague} 199c2f8f34eSDerick Montague``` 200c2f8f34eSDerick Montague 201*7385e139SPatrick Williams[Learn more about using Bootstrap functions](https://getbootstrap.com/docs/4.0/getting-started/theming/#functions) 202*7385e139SPatrick Williams 203c2f8f34eSDerick Montague## Adding a logo 204*7385e139SPatrick Williams 205c2f8f34eSDerick MontagueThe updated page header can include a small logo. The guidelines for adding a 206c2f8f34eSDerick Montaguelogo and the suggested logo dimensions are currently in progress. It may be 207c2f8f34eSDerick Montaguechallenging to meet all organization brand guidelines due to the minimal height 208c2f8f34eSDerick Montagueof the page header. The company logo might be able to be set in the primary 209c2f8f34eSDerick Montaguenavigation, but a design supporting that option will be the focus of future 210c2f8f34eSDerick Montaguedesign work. 211