Skip to content

Commit

Permalink
Use better contrast colors for links
Browse files Browse the repository at this point in the history
This removes the separate colors for visited and unvisited. We now use the
darker of the two in light mode and the ligher of the two in dark mode. These
colors satisfy AA color contrast, both against the background and against the
surrounding black/white text (see
sympy#23159).

This replaces the "brand-content" color in light mode since this is primarily
used for links. We still use the lighter color for the API function names in
light mode, so that they pop out more (dark mode already has a lighter color
for API function names).
  • Loading branch information
asmeurer authored and maurogaravello committed Apr 14, 2022
1 parent 26eea95 commit db2a8ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
20 changes: 10 additions & 10 deletions doc/src/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,22 @@ dl.py .field-list dt, dl[class]:not(.option-list):not(.field-list):not(.footnote
font-size: 120%;
}

/* Disable underlines on links except on hover, and give visited links a*/
/* darker green color. */
/* Disable underlines on links except on hover */
a {
text-decoration: none;
}
a:visited {
color: #307748;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:visited:hover {
color: #307748;
text-decoration: underline;
}
/* TODO: Some styling for visited? */
/* a:visited { */
/* color: #307748; */
/* text-decoration: none; */
/* } */
/* a:visited:hover { */
/* color: #307748; */
/* text-decoration: underline; */
/* } */

/* Change the background color of the code blocks (light mode). This should be*/
/* --color-code-background but setting it in conf.py doesn't work.*/
Expand Down
9 changes: 5 additions & 4 deletions doc/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
common_theme_variables = {
# Main "SymPy green" colors. Many things uses these colors.
"color-brand-primary": "#81B953",
"color-brand-content": "#29A329",
"color-brand-content": "#307748",

# The left sidebar.
"color-sidebar-background": "#3B5526",
Expand All @@ -170,13 +170,12 @@
"color-sidebar-item-background--hover": "#8AB950",
"color-sidebar-item-expander-background--hover": "#8AB950",

"color-link-underline--hover": "var(--color-link)",
"color-api-keyword": "#000000bd",
"color-api-name": "var(--color-brand-content)",
"color-api-name": "#29A329",
"color-api-pre-name": "var(--color-brand-primary)",
"api-font-size": "var(--font-size--normal)",
"color-foreground-secondary": "#53555B",
"color-link-hover": "var(--color-link)",
"color-link-underline--hover": "#29A329",

# TODO: Add the other types of admonitions here if anyone uses them.
"color-admonition-title-background--seealso": "#CCCCCC",
Expand All @@ -201,6 +200,8 @@
# The dark variables automatically inherit values from the light variables
"dark_css_variables": {
**common_theme_variables,
"color-brand-content": "#29A329",
"color-link": "var(--color-brand-content)",
"color-api-keyword": "#FFFFFFbd",
"color-api-overall": "#FFFFFF90",
"color-api-paren": "#FFFFFF90",
Expand Down

0 comments on commit db2a8ae

Please sign in to comment.