How to configure the checked
content tab's background color
#6699
-
How can I reinstate the background accent color on the Previously (in v8.3.1), the Currently, the As far as I can determine from inspecting the element, this is the modification that is required in the .md-typeset .tabbed-set>input:first-child:checked~.tabbed-labels>:first-child,.md-typeset .tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10),.md-typeset .tabbed-set>input:nth-child(11):checked~.tabbed-labels>:nth-child(11),.md-typeset .tabbed-set>input:nth-child(12):checked~.tabbed-labels>:nth-child(12),.md-typeset .tabbed-set>input:nth-child(13):checked~.tabbed-labels>:nth-child(13),.md-typeset .tabbed-set>input:nth-child(14):checked~.tabbed-labels>:nth-child(14),.md-typeset .tabbed-set>input:nth-child(15):checked~.tabbed-labels>:nth-child(15),.md-typeset .tabbed-set>input:nth-child(16):checked~.tabbed-labels>:nth-child(16),.md-typeset .tabbed-set>input:nth-child(17):checked~.tabbed-labels>:nth-child(17),.md-typeset .tabbed-set>input:nth-child(18):checked~.tabbed-labels>:nth-child(18),.md-typeset .tabbed-set>input:nth-child(19):checked~.tabbed-labels>:nth-child(19),.md-typeset .tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),.md-typeset .tabbed-set>input:nth-child(20):checked~.tabbed-labels>:nth-child(20),.md-typeset .tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),.md-typeset .tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),.md-typeset .tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),.md-typeset .tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),.md-typeset .tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),.md-typeset .tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),.md-typeset .tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9) {
background-color: var(--md-accent-fg-color);
} However, I assume there is a better way to implement the modification that I am not aware of. Maybe in content.html or _tabbed.scss (from commit history: 5deec28?diff=split&w=0#diff-dbced4a35e10d8879f35ea6cbd0074a6a8fb687dd330bc7344c3a787164baea4L118-R123)? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
Hello @santaimpersonator, color: var(--md-accent-fg-color);
background-color: var(--md-mermaid-sequence-loop-bg-color); The black bar is managed by the As for the other files:
|
Beta Was this translation helpful? Give feedback.
-
|
Light Theme | Dark Theme |
---|---|
![]() |
![]() |
Modification to docs/stylesheet/extra.css
:
/* ================================================================================== */
/* Content Tabs */
/* ================================================================================== */
/* Sets color of active label to accent, when mouse is hovered over item */
.md-typeset .tabbed-labels > label > a:hover {
background-color: var(--md-accent-fg-color);
}
/* Sets color of active label to primary */
.md-typeset .tabbed-set>input:first-child:checked~.tabbed-labels>:first-child,
.md-typeset .tabbed-set>input:nth-child(2):checked~.tabbed-labels>:nth-child(2),
.md-typeset .tabbed-set>input:nth-child(3):checked~.tabbed-labels>:nth-child(3),
.md-typeset .tabbed-set>input:nth-child(4):checked~.tabbed-labels>:nth-child(4),
.md-typeset .tabbed-set>input:nth-child(5):checked~.tabbed-labels>:nth-child(5),
.md-typeset .tabbed-set>input:nth-child(6):checked~.tabbed-labels>:nth-child(6),
.md-typeset .tabbed-set>input:nth-child(7):checked~.tabbed-labels>:nth-child(7),
.md-typeset .tabbed-set>input:nth-child(8):checked~.tabbed-labels>:nth-child(8),
.md-typeset .tabbed-set>input:nth-child(9):checked~.tabbed-labels>:nth-child(9),
.md-typeset .tabbed-set>input:nth-child(10):checked~.tabbed-labels>:nth-child(10),
.md-typeset .tabbed-set>input:nth-child(11):checked~.tabbed-labels>:nth-child(11),
.md-typeset .tabbed-set>input:nth-child(12):checked~.tabbed-labels>:nth-child(12),
.md-typeset .tabbed-set>input:nth-child(13):checked~.tabbed-labels>:nth-child(13),
.md-typeset .tabbed-set>input:nth-child(14):checked~.tabbed-labels>:nth-child(14),
.md-typeset .tabbed-set>input:nth-child(15):checked~.tabbed-labels>:nth-child(15),
.md-typeset .tabbed-set>input:nth-child(16):checked~.tabbed-labels>:nth-child(16),
.md-typeset .tabbed-set>input:nth-child(17):checked~.tabbed-labels>:nth-child(17),
.md-typeset .tabbed-set>input:nth-child(18):checked~.tabbed-labels>:nth-child(18),
.md-typeset .tabbed-set>input:nth-child(19):checked~.tabbed-labels>:nth-child(19),
.md-typeset .tabbed-set>input:nth-child(20):checked~.tabbed-labels>:nth-child(20) {
background-color: var(--md-primary-fg-color--light);
}
The color variables are based on the color palette that is defined for our light/dark theme in the mkdocs.yml
file:
# Adds light/dark theme to the webpage
palette:
# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
primary: grey
accent: red
toggle:
icon: material/brightness-auto
name: Switch to dark mode
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
primary: grey
accent: red
scheme: default
toggle:
icon: material/brightness-7
name: Switch to system preference
# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
primary: grey
accent: red
scheme: slate
toggle:
icon: material/weather-night
name: Switch to light mode
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Current Solution:
Required modification to
docs/stylesheet/extra.css
: