Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STYLE: style admonitions #1043

Merged
merged 7 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 27 additions & 8 deletions src/pydata_sphinx_theme/assets/styles/content/_admonitions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ div.admonition,
}

&.attention {
border-color: var(--pst-color-warning);
border-color: var(--pst-color-attention);
> .admonition-title {
&:before {
background-color: var(--pst-color-warning);
background-color: var(--pst-color-attention);
}

&:after {
color: var(--pst-color-warning);
color: var(--pst-color-attention);
content: var(--pst-icon-admonition-attention);
}
}
Expand Down Expand Up @@ -158,14 +158,14 @@ div.admonition,
}

&.important {
border-color: var(--pst-color-success);
border-color: var(--pst-color-attention);
> .admonition-title {
&:before {
background-color: var(--pst-color-success);
background-color: var(--pst-color-attention);
}

&:after {
color: var(--pst-color-success);
color: var(--pst-color-attention);
content: var(--pst-icon-admonition-important);
}
}
Expand Down Expand Up @@ -199,6 +199,20 @@ div.admonition,
}
}

&.admonition-todo {
border-color: var(--pst-color-border);
> .admonition-title {
&:before {
background-color: var(--pst-color-border);
}

&:after {
color: var(--pst-color-border);
content: var(--pst-icon-admonition-todo);
}
}
}

/**
* Special-case for a `sidebar` class that makes the admonition float to
* the right like the {sidebar} directive.
Expand All @@ -216,6 +230,10 @@ div.admonition,
// TODO: these semantic-color-names border-color rules might no longer be
// needed when we drop support for Sphinx 4 / docutils 0.17
&.attention,
&.important {
border-color: var(--pst-color-attention);
}

&.caution,
&.warning {
border-color: var(--pst-color-warning);
Expand All @@ -228,11 +246,12 @@ div.admonition,

&.hint,
&.tip,
&.important {
&.seealso {
border-color: var(--pst-color-success);
}

&.note {
&.note,
&.todo {
border-color: var(--pst-color-info);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ html {
* Admonitions
**/

--pst-icon-admonition-default: var(--pst-icon-info-circle);
--pst-icon-admonition-default: var(--pst-icon-bell);
--pst-icon-admonition-note: var(--pst-icon-info-circle);
--pst-icon-admonition-attention: var(--pst-icon-exclamation-circle);
--pst-icon-admonition-caution: var(--pst-icon-exclamation-triangle);
Expand All @@ -14,4 +14,5 @@ html {
--pst-icon-admonition-tip: var(--pst-icon-lightbulb);
--pst-icon-admonition-important: var(--pst-icon-exclamation-circle);
--pst-icon-admonition-seealso: var(--pst-icon-share);
--pst-icon-admonition-todo: var(--pst-icon-pencil);
}
14 changes: 9 additions & 5 deletions src/pydata_sphinx_theme/assets/styles/variables/_color.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@ $pst-semantic-colors: (
"light": rgb(40, 167, 69),
"dark": rgb(72, 135, 87),
),
"attention": (
"light": rgb(255, 193, 7),
"dark": rgb(220, 169, 15),
),
"danger": (
"light": rgb(220, 53, 69),
"dark": rgb(203, 70, 83),
),
"text-base": (
// Black + 50
"light": rgb(50, 50, 50),
// White - 50
// Black + 50
"dark": rgb(206, 206, 206),
// White - 50
),
"text-muted": (
// Twice as far from 0 as base
"light": rgb(100, 100, 100),
// Twice as far from 256 as base
// Twice as far from 0 as base
"dark": rgb(166, 166, 166),
// Twice as far from 256 as base
),
"shadow": (
"light": rgb(216, 216, 216),
Expand Down Expand Up @@ -93,7 +97,7 @@ $pst-semantic-colors: (
}
// assign the "duplicate" colors (ones that just reference other variables)
--pst-color-link: var(--pst-color-primary);
--pst-color-link-hover: var(--pst-color-secondary);
--pst-color-link-hover: var(--pst-color-warning);
// adapt to light/dark-specific content
@if $mode == "light" {
.only-dark {
Expand Down
2 changes: 2 additions & 0 deletions src/pydata_sphinx_theme/assets/styles/variables/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ html {
--pst-icon-github: "\f09b"; // fa-brands fa-github
--pst-icon-gitlab: "\f296"; // fa-brands fa-gitlab
--pst-icon-share: "\f064"; // fa-solid fa-share
--pst-icon-bell: "\f0f3"; // fa-solid fa-bell
--pst-icon-pencil: "\f303"; // fa-solid fa-pencil
}