Skip to content

Commit fab8233

Browse files
authored
👌 IMPROVE: Styling for tabs (#21)
- Introduce "hover" state styling for tabs: The lifecycle of a tab is now "inactive -> hover -> active". - Completely un-mix styling for different states of a tab. - Use a higher contrast color for inactive tabs. - Convert tab underline and overline to greys: A more neutral colour to fit in better with the rest of the content. Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
1 parent c79d9d6 commit fab8233

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

docs/css_variables.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@ The defaults are:
5656
--sd-color-card-header: transparent;
5757
--sd-color-card-footer: transparent;
5858
--sd-color-tabs-label-active: hsla(231, 99%, 66%, 1);
59-
--sd-color-tabs-label-inactive: rgba(178, 206, 245, 0.62);
60-
--sd-color-tabs-overline: rgb(207, 236, 238);
61-
--sd-color-tabs-underline: rgb(207, 236, 238);
59+
--sd-color-tabs-label-hover: hsla(231, 99%, 66%, 1);
60+
--sd-color-tabs-label-inactive: hsl(0, 0%, 66%);
61+
--sd-color-tabs-underline-active: hsla(231, 99%, 66%, 1);
62+
--sd-color-tabs-underline-hover: rgba(178, 206, 245, 0.62);
63+
--sd-color-tabs-underline-inactive: transparent;
64+
--sd-color-tabs-overline: rgb(222, 222, 222);
65+
--sd-color-tabs-underline: rgb(222, 222, 222);
6266
--sd-fontsize-tabs-label: 1rem
6367
}
6468
```

sphinx_design/compiled/style.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

style/_tabs.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
// Active tab label
1515
&:checked + label {
16-
border-color: var(--sd-color-tabs-label-active);
16+
border-color: var(--sd-color-tabs-underline-active);
1717
color: var(--sd-color-tabs-label-active);
1818

1919
// Show tabbed block content
@@ -23,7 +23,8 @@
2323
}
2424

2525
&:not(:checked) + label:hover {
26-
border-color: var(--sd-color-tabs-label-inactive);
26+
color: var(--sd-color-tabs-label-hover);
27+
border-color: var(--sd-color-tabs-underline-hover);
2728
}
2829

2930
// Focused tab label
@@ -43,6 +44,7 @@
4344
border-bottom: 0.125rem solid transparent;
4445
margin-bottom: 0;
4546
color: var(--sd-color-tabs-label-inactive);
47+
border-color: var(--sd-color-tabs-underline-inactive);
4648
cursor: pointer;
4749
font-size: var(--sd-fontsize-tabs-label);
4850
font-weight: 700;

style/_variables.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@
2222
--sd-color-card-footer: transparent;
2323
// tabs
2424
--sd-color-tabs-label-active: hsla(231, 99%, 66%, 1);
25-
--sd-color-tabs-label-inactive: rgba(178, 206, 245, 0.62);
26-
--sd-color-tabs-overline: rgb(207, 236, 238);
27-
--sd-color-tabs-underline: rgb(207, 236, 238);
25+
--sd-color-tabs-label-hover: hsla(231, 99%, 66%, 1);
26+
--sd-color-tabs-label-inactive: hsl(0, 0%, 66%);
27+
--sd-color-tabs-underline-active: hsla(231, 99%, 66%, 1);
28+
--sd-color-tabs-underline-hover: rgba(178, 206, 245, 0.62);
29+
--sd-color-tabs-underline-inactive: transparent;
30+
--sd-color-tabs-overline: rgb(222, 222, 222);
31+
--sd-color-tabs-underline: rgb(222, 222, 222);
2832
--sd-fontsize-tabs-label: 1rem;
2933
}

0 commit comments

Comments
 (0)