Skip to content

Commit de547eb

Browse files
gabalafoudrammock
authored andcommitted
Restyle Sphinx Design tabs (#1555)
* restyle sphinx design tabs * increase panel border radius * increase line height, zero padding-y * use shadow variable * Update src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss * Update src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss
1 parent 78c91c0 commit de547eb

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss

+31-11
Original file line numberDiff line numberDiff line change
@@ -174,27 +174,47 @@ html[data-theme="light"] {
174174
> input {
175175
// Active tab label
176176
&:checked + label {
177-
border-color: transparent transparent var(--pst-color-primary); // top LR bottom
177+
border-style: solid solid none;
178+
border-color: var(--pst-color-primary) var(--pst-color-primary)
179+
transparent; // top LR bottom
180+
border-width: 0.125rem 0.125rem 0;
181+
border-radius: 0.125rem 0.125rem 0 0;
182+
background-color: var(--pst-color-background);
183+
transform: translateY(0.125rem);
178184
color: var(--pst-color-primary);
179185
}
180186

187+
&:focus-visible + label {
188+
border: 0.125rem solid var(--pst-color-accent);
189+
border-radius: 0.125rem;
190+
background-color: var(--pst-color-accent-bg);
191+
color: var(--pst-color-on-surface);
192+
}
193+
181194
// Hover label
182-
&:not(:checked) + label:hover {
183-
border-color: var(--pst-color-secondary);
195+
&:not(:checked):not(:focus-visible) + label:hover {
196+
border-color: transparent;
184197
color: var(--pst-color-secondary);
185198
}
186199
}
187200

188201
// Tab label
189202
> label {
190-
color: var(--pst-color-text-muted);
191-
border-top: 0.125rem solid transparent; // so hover isn't just color change
192-
padding-top: 0.5em; // same as bottom padding, so hover overline looks OK
193-
// Hovered label
194-
html &:hover {
195-
color: var(--pst-color-secondary);
196-
border-color: var(--pst-color-secondary);
197-
}
203+
color: var(--pst-color-on-surface);
204+
border: 0.125rem solid transparent;
205+
border-radius: 0.125rem 0.125rem 0px 0px;
206+
background-color: var(--pst-color-surface);
207+
padding: 0 0.75em;
208+
margin-inline-end: 0.25rem;
209+
line-height: 1.95;
210+
}
211+
212+
// panel
213+
.sd-tab-content {
214+
border: 0.125rem solid var(--pst-color-primary);
215+
border-radius: 0.1875rem;
216+
box-shadow: unset;
217+
padding: 0.625rem;
198218
}
199219
}
200220

0 commit comments

Comments
 (0)