Skip to content

Commit 5b844a3

Browse files
committed
Support for adding and modifying theme colors
1 parent 5fddc02 commit 5b844a3

4 files changed

Lines changed: 52 additions & 28 deletions

File tree

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/*
2-
3-
Nothing defined here. The Hugo project that uses this theme can override theme variables by adding a file to:
4-
5-
assets/scss/_variables_project.scss
6-
2+
Projects can override this file. For details, see:
3+
https://www.docsy.dev/docs/adding-content/lookandfeel/#project-style-files
74
*/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/*
2+
Projects can override this file. For details, see:
3+
https://www.docsy.dev/docs/adding-content/lookandfeel/#project-style-files
4+
*/

assets/scss/main.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import "../vendor/bootstrap/scss/functions";
22

3-
@import "_variables_forward";
3+
@import "variables_forward";
44
@import "variables_project";
55
@import "variables";
66
@import "support/mixins";
@@ -12,6 +12,8 @@
1212
@import "../vendor/Font-Awesome/scss/solid.scss";
1313
@import "../vendor/Font-Awesome/scss/brands.scss";
1414

15+
@import "variables_project_after_bs";
16+
1517
@import "support/utilities";
1618
@import "colors";
1719
@import "table";

userguide/content/en/docs/adding-content/lookandfeel.md

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,29 @@ Prism for highlighting.
2222

2323
## Project style files
2424

25-
To customize your project's look and feel, create your own version of either or
26-
both of the following Docsy placeholder files (note the **`_project.scss`**
27-
suffixes):
28-
29-
- [`assets/scss/`**`_variables_project.scss`**][_variables_project] is where you
30-
add project-specific definitions of theme variables such as [site
31-
colors](#site-colors), as well as any additional Bootstrap variable values you
32-
want to set. You can find a list of Docsy's theme variables and their default
33-
values in [`assets/scss/`**`_variables.scss`**][_variables]. For information
34-
about other Bootstrap 5 variables, see [Variable defaults] and Bootstrap's
35-
[`_variables.scss`] file.
36-
- [`assets/scss/`**`_styles_project.scss`**][_styles_project] is where you can
37-
add your own custom SCSS styles, including overriding any of the styles in
38-
Docsy's theme SCSS files.
39-
40-
[_styles_project]: https://github.com/google/docsy/blob/main/assets/scss/_styles_project.scss
41-
[_variables_project]: https://github.com/google/docsy/blob/main/assets/scss/_variables_project.scss
42-
[_variables]: https://github.com/google/docsy/blob/main/assets/scss/_variables.scss
43-
[`_variables.scss`]: https://github.com/twbs/bootstrap/blob/v5.2.3/scss/_variables.scss
44-
[variable defaults]: https://getbootstrap.com/docs/5.3/customize/sass/#variable-defaults
25+
To customize your project's look and feel, create your own version of the
26+
following Docsy placeholder files (note the **`_project*.scss`** suffixes) and
27+
place them inside your project's `assets/scss/` folder:
28+
29+
- **`_variables_project.scss`**[^vp] and<br>
30+
**`_variables_project_after_bs.scss`**[^vpabs] :
31+
32+
Use these files to add project-specific definitions of theme variables such as
33+
[site colors](#site-colors) (explained in the next section), as well as any
34+
additional Bootstrap variable values you want to set. You can find a list of
35+
Docsy's theme variables and their default values in `_variables.scss`[^v]. For
36+
information about other Bootstrap 5 variables, see [Variable defaults] and
37+
Bootstrap's `_variables.scss`[^bv] file.
38+
39+
- **`_styles_project.scss`**[^sp] is where you can add your own custom SCSS
40+
styles, including overriding any of the styles in Docsy's theme SCSS files.
41+
42+
[^bv]: https://github.com/twbs/bootstrap/blob/v5.3.3/scss/_variables.scss
43+
[^sp]: https://github.com/google/docsy/blob/main/assets/scss/_styles_project.scss
44+
[^v]: https://github.com/google/docsy/blob/main/assets/scss/_variables.scss
45+
[^vp]: https://github.com/google/docsy/blob/main/assets/scss/_variables_project.scss
46+
[^vpabs]: https://github.com/google/docsy/blob/main/assets/scss/_variables_project_after_bs.scss
47+
4548

4649
{{% alert title="Tip" %}}
4750
PostCSS (autoprefixing of CSS browser-prefixes) is not enabled when running in server mode (it is a little slow), so Chrome is the recommended choice for development.
@@ -50,8 +53,8 @@ PostCSS (autoprefixing of CSS browser-prefixes) is not enabled when running in s
5053
## Site colors
5154

5255
To customize your site's colors, add SCSS variable overrides to
53-
`assets/scss/_variables_project.scss`. For example, you can set the primary and
54-
secondary site colors as follows:
56+
**`assets/scss/_variables_project.scss`**. For example, you can set the primary
57+
and secondary site colors as follows:
5558

5659
```scss
5760
$primary: #390040;
@@ -62,6 +65,24 @@ The theme has features such as gradient backgrounds (`$enable-gradients`) and
6265
shadows (`$enable-shadows`) enabled by default. These can also be toggled in
6366
your project variables file by setting the variables to `false`.
6467

68+
To can add colors to or modify Bootstrap's [color maps], use
69+
**`assets/scss/_variables_project_after_bs.scss`**. For example:
70+
71+
```scss
72+
$custom-colors: (
73+
"my-favorite-color": purple
74+
);
75+
76+
$theme-colors: map-merge($theme-colors, $custom-colors);
77+
```
78+
79+
Learn how to modify maps, see [Maps and loops] and [Adding theme colors].
80+
81+
[Adding theme colors]: https://getbootstrap.com/docs/5.3/customize/color-modes/#adding-theme-colors
82+
[color maps]: https://getbootstrap.com/docs/5.3/customize/color/#color-sass-maps
83+
[Maps and loops]: https://getbootstrap.com/docs/5.3/customize/sass/#maps-and-loops
84+
[variable defaults]: https://getbootstrap.com/docs/5.3/customize/sass/#variable-defaults
85+
6586
## Fonts
6687

6788
The theme uses [Open Sans](https://fonts.google.com/specimen/Open+Sans) as its primary font. To disable Google Fonts and use a system font, set this SCSS variable in `assets/scss/_variables_project.scss`:

0 commit comments

Comments
 (0)