Skip to content

Commit

Permalink
POC: Make flyout font sizes customizable with a single css variable (#…
Browse files Browse the repository at this point in the history
…181)

Fixes #95 
Closes #175 

This is missing proper documentation, but basically, by setting
`--readthedocs-flyout-font-size` CSS variable on the flyout, you can
control all of the font-sizes at once. For finer control, it's possible
to instead override more specific CSS variables.

---------

Co-authored-by: Manuel Kaufmann <[email protected]>
  • Loading branch information
zanderle and humitos authored Nov 7, 2023
1 parent 3ff4fa3 commit f74dfba
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dist/readthedocs-addons.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/readthedocs-addons.js.map

Large diffs are not rendered by default.

21 changes: 17 additions & 4 deletions src/flyout.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
top: 50px;
}

:root {
--readthedocs-flyout-font-size: 0.8rem;
}

:host > div {
font-family: var(
--readthedocs-flyout-font-family,
Expand All @@ -38,7 +42,7 @@
"Arial",
"sans-serif"
);
font-size: var(--readthedocs-flyout-font-size, 0.8rem);
font-size: var(--readthedocs-flyout-font-size);
color: var(--readthedocs-flyout-color, rgb(128, 128, 128));
background-color: var(--readthedocs-flyout-background-color, rgb(39, 39, 37));
z-index: 3000;
Expand All @@ -60,7 +64,10 @@ header {

header > span {
color: var(--readthedocs-flyout-current-version-color, #27ae60);
font-size: var(--readthedocs-flyout-header-font-size, 0.9rem);
font-size: var(
--readthedocs-flyout-header-font-size,
calc(var(--readthedocs-flyout-font-size) * 1.125)
);
}

header > img.logo {
Expand All @@ -85,14 +92,20 @@ dl {
}

dl > dt {
font-size: var(--readthedocs-flyout-dt-font-size, 0.9rem);
font-size: var(
--readthedocs-flyout-dt-font-size,
calc(var(--readthedocs-flyout-font-size) * 1.125)
);
color: var(--readthedocs-flyout-section-heading-color, rgb(128, 128, 128));
}

dl > dd {
display: inline-block;
margin: 0;
font-size: var(--readthedocs-flyout-dd-font-size, 0.9rem);
font-size: var(
--readthedocs-flyout-dd-font-size,
calc(var(--readthedocs-flyout-font-size) * 1.125)
);
}

dd a {
Expand Down

0 comments on commit f74dfba

Please sign in to comment.