On this page
How to override base theme settings
The USWDS comes with a lot of settings, which are documented at Settings, in order to modify any of them you can follow the next steps:
-
Open the sass/_settings.scss file.
-
You will find something like this:
@use "uswds-core" with (
$theme-show-compile-warnings: false,
$theme-show-notifications: false,
$theme-image-path: '/themes/custom/my_new_theme/assets/uswds/img',
$theme-grid-container-max-width: "widescreen",
$theme-banner-max-width: "widescreen",
$theme-header-max-width: "widescreen",
); -
Add modify those settings or add the ones you need to modify.
-
Compile the sass:
npm run build -
Done.
Example: Change the primary color family to red.
-
Go to the sass/_settings.scss file.
-
Add the following setting inside the with(…):
$theme-color-primary-family: 'red',
$theme-color-primary:'red-60v',
$theme-color-primary-dark: 'red-warm-70v',
$theme-color-primary-darker: 'red-warm-80v', -
The result should be the following:
@use "uswds-core" with (
$theme-show-compile-warnings: false,
$theme-show-notifications: false,
$theme-image-path: '/themes/custom/my_new_theme/assets/uswds/img',
$theme-grid-container-max-width: "widescreen",
$theme-banner-max-width: "widescreen",
$theme-header-max-width: "widescreen",
$theme-color-primary-family: 'red',
$theme-color-primary:'red-60v',
$theme-color-primary-dark: 'red-warm-70v',
$theme-color-primary-darker: 'red-warm-80v'
); npm run build-
Clear the cache, just in case.
-
Done.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion