Customization
Take advantage of the Awesome's past, current and future updates, by learning how to create your own content without changing the core styles of Awesome.
With SASS
-
Use the
$font-family-baseattribute as our typographic base applied to the<body>in_user-variables.scssfile to change the current font family variable with yours.$font-family-base: "Roboto", Helvetica, Arial, sans-serif; -
Add your font stylesheet into the
<head>before all other stylesheets. Like:<!-- CSS Global Compulsory --> <link href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
With CSS
-
Simply replace the font family
font-familyfrom<body>intheme.csstag with yours.body { font-family: "Roboto", Helvetica, Arial, sans-serif; } -
Add your font stylesheet into the
<head>before all other stylesheets. Like:<!-- CSS Global Compulsory --> <link href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
SASS
Utilize our source SASS files to take advantage of variables, mixins, and more.
Whenever possible, avoid modifying Awesome's core files. For SASS, that means creating your own stylesheet that imports Bootstrap so you can modify and extend it.
Customizing SASS
To avoid file loss, overrides of your custom styles or any other conflicts during the upgrade process, create or modify your styles with these 2 files assets/include/scss/:
_user-variables.scss- Variables file for customizing or overriding Bootstrap core and Awesome elements/components that have been tied to variables._user.scss- Create a new style in here.
Note
Custom files along with Bootstrap core CSS files will be generated in to the theme.css file.
Variable defaults
Every SASS variable in Awesome includes the !default flag allowing you to override the variable's default value in your own SASS without modifying either Bootstrap or Awesome's source code. Copy and paste variables as needed, modify their values, and remove the !default flag. If a variable has already been assigned, then it won't be re-assigned by the default values in Awesome.
You will find the complete list of Awesome's variables in assets/include/scss/_variables.scss.
Variable overrides within the same SASS file can come before or after the default variables. However, when overriding across SASS files, your overrides must come before you import Awesome's SASS files.
Here's an example that changes the color of the template in the scss/custom/_custom-variables.scss file when importing and compiling Awesome via npm:
// Your variable overrides
$blue: #107ef4;
Maps and loops
Bootstrap 4 includes a handful of SASS maps, key value pairs that make it easier to generate families of related CSS. We use SASS maps for our colors, grid breakpoints, and more. Just like SASS variables, all SASS maps include the !default flag and can be overridden and extended.
Some of our SASS maps are merged into empty ones by default. This is done to allow easy expansion of a given SASS map, but comes at the cost of making removing items from a map slightly more difficult.
Modify map
To modify an existing color in our $theme-colors map, add the following to your custom SASS file:
$theme-colors: (
"primary": #444bf8,
"danger": #f12559
);
Add to map
To add a new color to $theme-colors, add the new key and value:
$theme-colors: (
"custom-color": #000
);
SASS options
Customize Awesome with our built-in custom variables file and easily toggle global CSS preferences with $enable-* SASS variables.
You can find and customize these variables for key global options in Awesome's scss/_variables.scss file.
Color
Many of Awesome's various components and utilities are built through a series of colors defined in a SASS map. This map can be looped over in SASS to quickly generate a series of rulesets.
All colors
All colors available in Awesome, are available as SASS variables and a SASS map in scss/_variables.scss file.
Here's how you can use these in your SASS:
.alpha {
color: $primary;
}
// From the SASS map with Bootstrap `color()` function {
.beta {
color: color("purple");
}
Color utility classes are also available for setting color and background-color.
Theme colors
We use a subset of all Bootstrap colors to create a smaller color palette for generating color schemes, also available as SASS variables and a SASS map in Awesome's scss/_variables.scss file.
Grays
An expansive set of gray variables and a SASS map in scss/_variables.scss for consistent shades of gray across your project.
SASS Components
Many of Bootstrap's components and utilities are built with @each loops that iterate over a SASS map. This is especially helpful for generating variants of a component by $theme-colors and creating responsive variants for each breakpoint. As you customize these SASS maps and recompile, you'll automatically see your changes reflected in these loops.
Modifiers
Many of Bootstrap and Awesome's components are built with a base-modifier class approach. This means the bulk of the styling is contained to a base class (e.g., .btn) while style variations are confined to modifier classes (e.g., .btn-danger). These modifier classes are built from the $theme-colors map to make customizing the number and name of our modifier classes.
Here are two examples of how we loop over the $theme-colors map to generate modifiers to the .alert component and all our .bg-* background utilities.
// Generate '.bg-*' color utilities
@each $color, $value in $theme-colors {
@include bg-variant('.bg-#{$color}', $value);
}