diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_links.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_links.scss index c3e9d31c0..212170efd 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_links.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_links.scss @@ -217,6 +217,6 @@ $link-hover-decoration-thickness: string.unquote( &:focus-visible { box-shadow: none; // override Bootstrap outline: 3px solid var(--pst-color-accent); - outline-offset: 3px; + outline-offset: $focus-ring-width; } } diff --git a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss index ffbd79c75..a4e41bf19 100644 --- a/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss +++ b/src/pydata_sphinx_theme/assets/styles/abstracts/_mixins.scss @@ -64,3 +64,15 @@ min-width: 24px; min-height: 24px; } + +// Meant to darken the element on hover in light mode, or +// lighten on hover in dark mode. +@mixin hover-darken-lighten { + &:hover { + filter: brightness(0.9); + + html[data-theme="dark"] & { + filter: brightness(1.1); + } + } +} 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 7c86cdd3d..dc403321f 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss @@ -322,12 +322,20 @@ details.sd-dropdown { top: 0.7rem; } + @include hover-darken-lighten; + // Focus ring &:focus:focus-visible { outline: $focus-ring-outline; - outline-offset: -$focus-ring-width; + outline-offset: $focus-ring-offset; + border-radius: $focus-ring-width; } } + + &[open] summary.sd-card-header:focus:focus-visible { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + } } /******************************************************************************* @@ -358,14 +366,16 @@ html { .sd-btn-#{$name}, .sd-btn-outline-#{$name} { &:focus-visible { + outline: var(--sd-color-#{$name}) solid $focus-ring-width; + outline-offset: $focus-ring-offset; + border-radius: $focus-ring-width; + // Override Sphinx Design's use of -highlight colors. The -highlight // colors are 15% darker, so this would create the effect of darkening // the button when focused but we just want the button to have a focus // ring of the same (non-highlight) color. background-color: var(--sd-color-#{$name}) !important; border-color: var(--sd-color-#{$name}) !important; - outline: var(--sd-color-#{$name}) solid $focus-ring-width; - outline-offset: $focus-ring-width; } } } diff --git a/src/pydata_sphinx_theme/assets/styles/extensions/_togglebutton.scss b/src/pydata_sphinx_theme/assets/styles/extensions/_togglebutton.scss index 1d0f87cc4..2d5ca3e5a 100644 --- a/src/pydata_sphinx_theme/assets/styles/extensions/_togglebutton.scss +++ b/src/pydata_sphinx_theme/assets/styles/extensions/_togglebutton.scss @@ -1,5 +1,9 @@ /** * Sphinx togglebutton + * + * The rules in this style sheet are meant to tweak the + * [sphinx-togglebutton](https://sphinx-togglebutton.readthedocs.io/en/latest/index.html) + * extension so that it matches the look and feel of this theme. */ .bd-content { @@ -17,8 +21,31 @@ } } - // Admonition toggles - .admonition { + // Apply this mixin to the element that will be hovered. These styles are + // intended to match what sphinx-design does for its dropdown admonitions. + @mixin icon-hover-effects { + &:hover .tb-icon { + opacity: 1; + scale: 1.1; + } + + .tb-icon { + opacity: 0.6; + } + } + + // Collapsible admonition, implemented as
+