Skip to content

Commit 4543388

Browse files
Improve color handling (#594)
* Improve color handling * Start documenting colors * Finish renaming colors and remove old names
1 parent 8df2210 commit 4543388

7 files changed

Lines changed: 77 additions & 65 deletions

File tree

assets/theme-css/footer.css

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
}
55

66
#footer {
7-
background-color: var(--colorPrimaryDark);
7+
background-color: var(--spht-color-dark);
8+
color: var(--spht-color-light);
89
position: sticky;
910
top: calc(100vh - var(--spht-footer-height));
1011
}
@@ -31,11 +32,11 @@
3132
}
3233

3334
.footer-item a {
34-
color: var(--colorSecondary);
35+
color: var(--spht-color-light);
3536
}
3637

3738
.footer-item a:hover {
38-
color: var(--colorPrimaryLight);
39+
color: var(--spht-color-link-hover);
3940
}
4041

4142
.footer-actions {
@@ -49,7 +50,6 @@
4950

5051
.footer-actions p {
5152
margin: 0;
52-
color: var(--colorSecondary);
5353
}
5454

5555
@media only screen and (max-width: 850px) {
@@ -85,25 +85,23 @@
8585
}
8686

8787
#footer svg.icon {
88-
fill: var(--colorSecondary);
88+
fill: var(--spht-color-light);
8989
margin-right: 0.5rem;
9090
}
9191

9292
#footer svg.icon:hover {
93-
fill: #ffffff;
93+
fill: var(--spht-color-link-hover);
9494
}
9595

9696
/* For information ⓘ, when icon is missing */
9797
#footer .icon {
9898
font-weight: 900;
99-
color: var(--colorSecondary);
10099
}
101100

102101
#footer nav {
103-
background: var(--colorPrimaryDark);
102+
background: var(--spht-color-dark);
104103
}
105104

106105
.copyright {
107106
font-size: 0.75rem;
108-
color: var(--colorSecondary);
109107
}

assets/theme-css/hero.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@
7272
text-transform: uppercase;
7373
letter-spacing: 1.5px;
7474
font-weight: 500;
75-
color: var(--colorSecondaryLight);
76-
background-color: var(--colorPrimaryDark);
75+
color: var(--spht-color-light);
76+
background-color: var(--spht-color-dark);
7777
border: none;
7878
border-radius: 25px;
7979
outline: none;
8080
cursor: pointer;
8181
}
8282

8383
.cta-button:hover {
84-
color: var(--colorPrimaryLight);
84+
color: var(--spht-color-link-hover);
8585
}
8686

8787
@media only screen and (max-width: 1090px) {

assets/theme-css/news.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
align-items: center;
55
width: 100vw;
66
min-height: 45px;
7-
background-color: var(--colorPrimaryDark);
8-
color: var(--colorSecondaryLight);
7+
background-color: var(--spht-color-dark);
8+
color: var(--spht-color-light);
99
white-space: nowrap;
1010
}
1111

1212
.news-container a {
13-
color: var(--colorSecondaryLight);
13+
color: var(--spht-color-light);
1414
}
1515

1616
.news-container a:hover {
17-
color: var(--colorPrimaryLight);
17+
color: var(--spht-color-link-hover);
1818
}
1919

2020
.news-title {

assets/theme-css/vars.css

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@
22
:root {
33
--fontFamily: "{{ .Site.Params.font.name }}", "Noto Sans Symbols 2";
44

5-
--colorPrimaryDark: rgb(1, 50, 67);
6-
--colorPrimary: rgb(77, 119, 207);
7-
--colorPrimaryLight: rgb(77, 171, 207);
8-
9-
--colorSecondaryDark: rgb(108, 122, 137);
10-
--colorSecondary: rgb(238, 238, 238);
11-
--colorSecondaryLight: rgb(255, 255, 255);
12-
13-
--colorBrightBlue: rgb(30, 135, 240);
14-
--colorYellow: rgb(255, 197, 83);
15-
5+
--spht-color-dark: rgb(1, 50, 67);
6+
--spht-color-light: rgb(255, 255, 255);
7+
--spht-color-link-hover: rgb(77, 171, 207);
168
--spht-footer-height: 6em;
179

1810
/* Font Awesome icon variables. */

doc/content/user_guide/_index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,11 @@ There are a number of options for configuring your site’s look and feel.
1717

1818
- [Get Started](/user_guide/getstarted)
1919
- [Features](/user_guide/features)
20+
21+
## Content and features
22+
2023
- [Web Components](/user_guide/web-components)
24+
25+
## Theming and Style
26+
27+
- [Theme variables and CSS](/user_guide/styling)

doc/content/user_guide/features.md

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,11 @@ preamble. It defaults to 2.
2525
Each page should contain a `summary` in the preamble, otherwise the
2626
site description is provided as metadata.
2727

28-
## Custom stylesheets
29-
30-
Custom styles should be added to `/assets/css/my_css.css` (where
31-
`my_css` can be any name, other than those already in the theme).
32-
3328
## Custom JavaScript
3429

3530
Custom JavaScript can be added as `/assets/js/my_js.js` (where `my_js`
3631
can be any name).
3732

38-
## Code styling
39-
40-
To enable code styling, add the following to your config file:
41-
42-
```yaml
43-
markup:
44-
highlight:
45-
noClasses: false
46-
```
47-
48-
The default theme is [Witch Hazel](https://github.com/theacodes/witchhazel),
49-
but with a blue background.
50-
To use a different theme, [generate a new
51-
stylesheet](https://gohugo.io/content-management/syntax-highlighting/#highlight-shortcode)
52-
using:
53-
54-
```
55-
hugo gen chromastyles --style=monokai > /assets/css/code-highlight.css
56-
```
57-
58-
You can replace `monokai` with any of the themes supported by
59-
[Chroma](https://github.com/alecthomas/chroma), as listed in their
60-
[gallery](https://xyproto.github.io/splash/docs/).
61-
62-
Then, use fenced code blocks and remember to specify the language:
63-
64-
````md
65-
```python
66-
def foo(x):
67-
return x**2
68-
```
69-
````
70-
7133
## News
7234

7335
The first post from `/content/en/news` will be highlighted on the

doc/content/user_guide/styling.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: Theme variables and CSS
3+
---
4+
5+
This section covers a few ways that you can control the look and feel of your
6+
theme via your own CSS and theme variables.
7+
8+
## Custom CSS stylesheets
9+
10+
Custom styles should be added to `/assets/css/my_css.css` (where
11+
`my_css` can be any name, other than those already in the theme).
12+
13+
## CSS theme variables
14+
15+
### Color variables
16+
17+
We mostly rely on PyData Sphinx Theme's
18+
[color variables](https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/styling.html#color-variables).
19+
20+
However, we ...
21+
22+
## Code styling
23+
24+
To enable code styling, add the following to your config file:
25+
26+
```yaml
27+
markup:
28+
highlight:
29+
noClasses: false
30+
```
31+
32+
The default theme is [Witch Hazel](https://github.com/theacodes/witchhazel),
33+
but with a blue background.
34+
To use a different theme, [generate a new
35+
stylesheet](https://gohugo.io/content-management/syntax-highlighting/#highlight-shortcode)
36+
using:
37+
38+
```
39+
hugo gen chromastyles --style=monokai > /assets/css/code-highlight.css
40+
```
41+
42+
You can replace `monokai` with any of the themes supported by
43+
[Chroma](https://github.com/alecthomas/chroma), as listed in their
44+
[gallery](https://xyproto.github.io/splash/docs/).
45+
46+
Then, use fenced code blocks and remember to specify the language:
47+
48+
````md
49+
```python
50+
def foo(x):
51+
return x**2
52+
```
53+
````

0 commit comments

Comments
 (0)