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