diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_links.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_links.scss index 82f6e48ef..1d27c0bab 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_links.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_links.scss @@ -49,13 +49,12 @@ $link-hover-decoration-thickness: unquote("max(3px, .1875rem, .12em)") !default; } // Simple hover style - can be used alone or in conjunction with other mixins -// Add the text underline and change in thickness on hover +// Add the text underline and change in thickness on hover. +// Intended for use with the `:hover` pseudo-class. @mixin link-style-hover { - &:hover { - @include link-decoration; - @include link-decoration-hover; - color: var(--pst-color-link-hover); - } + @include link-decoration; + @include link-decoration-hover; + color: var(--pst-color-link-hover); } // Default link styles diff --git a/src/pydata_sphinx_theme/assets/styles/base/_base.scss b/src/pydata_sphinx_theme/assets/styles/base/_base.scss index ae4b2675e..32e4d7a16 100644 --- a/src/pydata_sphinx_theme/assets/styles/base/_base.scss +++ b/src/pydata_sphinx_theme/assets/styles/base/_base.scss @@ -185,8 +185,8 @@ pre { margin-inline-end: 0.5em; } - @include link-style-hover; &:hover { + @include link-style-hover; text-decoration-thickness: 1px; background-color: var(--pst-violet-600); color: var(--pst-color-secondary-text); diff --git a/src/pydata_sphinx_theme/assets/styles/components/_prev-next.scss b/src/pydata_sphinx_theme/assets/styles/components/_prev-next.scss index 69d040d52..d3e862ac5 100644 --- a/src/pydata_sphinx_theme/assets/styles/components/_prev-next.scss +++ b/src/pydata_sphinx_theme/assets/styles/components/_prev-next.scss @@ -30,15 +30,10 @@ font-size: 1.1em; } - &:hover p.prev-next-title { - @include link-style-hover; - } - // Exception here - keep visited in the default link colour - // it still should hover on the default link hover colour - &:visited p.prev-next-title { - color: var(--pst-color-link); - &:hover { - color: var(--pst-color-link-hover); + &:hover, + &:visited:hover { + p.prev-next-title { + @include link-style-hover; } } diff --git a/src/pydata_sphinx_theme/assets/styles/components/_switcher-version.scss b/src/pydata_sphinx_theme/assets/styles/components/_switcher-version.scss index d6281bf51..14230f28c 100644 --- a/src/pydata_sphinx_theme/assets/styles/components/_switcher-version.scss +++ b/src/pydata_sphinx_theme/assets/styles/components/_switcher-version.scss @@ -31,8 +31,8 @@ button.btn.version-switcher__button { &:not(:last-child) { border-bottom: 1px solid var(--pst-color-border); } - @include link-style-hover; &:hover { + @include link-style-hover; background-color: var(--pst-color-surface); } &.active { diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss index 66bdfdbfb..e4fd78db7 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -314,8 +314,8 @@ html { min-width: 2.25rem; padding: 0.3125rem 0.75rem 0.4375rem; // 5px 12px 7px - @include link-style-hover; // override Sphinx Design &:hover { + @include link-style-hover; // override Sphinx Design text-decoration-thickness: 1px; } } diff --git a/src/pydata_sphinx_theme/assets/styles/sections/_header.scss b/src/pydata_sphinx_theme/assets/styles/sections/_header.scss index 833d92811..880a9adae 100644 --- a/src/pydata_sphinx_theme/assets/styles/sections/_header.scss +++ b/src/pydata_sphinx_theme/assets/styles/sections/_header.scss @@ -110,7 +110,10 @@ button { display: unset; border: none; - @include link-style-hover; + + &:hover { + @include link-style-hover; + } } .dropdown-menu { @@ -154,7 +157,9 @@ } .nav-link { - @include link-style-hover; + &:hover { + @include link-style-hover; + } // Override Bootstrap transition: none;