Skip to content

Commit 6c9e7de

Browse files
committed
Fix theme for source rendering
1 parent e6df934 commit 6c9e7de

File tree

1 file changed

+82
-78
lines changed

1 file changed

+82
-78
lines changed

asset/css/doc.css

Lines changed: 82 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -382,41 +382,9 @@ span.sign-expand.open::before {
382382

383383
.modules { list-style-type: none; padding-left:0; }
384384

385-
/* Source links float inside preformated text or headings. */
386-
a.source_link {
387-
float: right;
388-
color: var(--source-link-color);
389-
font-family: "Fira Sans", sans-serif;
390-
font-size: initial;
391-
}
392-
393-
394-
.source_container {
395-
display: flex;
396-
}
397-
398-
.source_line_column {
399-
padding-right: 0.5em;
400-
text-align: right;
401-
color: var(--source-line-column);
402-
background: var(--source-line-column-bg);
403-
}
404-
405-
.source_line {
406-
padding: 0 1em;
407-
}
408-
409-
.source_code {
410-
flex-grow: 1;
411-
background: var(--code-background);
412-
padding: 0 0.3em;
413-
color: var(--code-color);
414-
}
415-
416385
/* Taken from odoc's css sheet */
417386

418-
:root,
419-
.light:root {
387+
.source_container {
420388

421389
/* light gruvbox theme colors */
422390
--bg_h: #f9f5d7;
@@ -460,51 +428,53 @@ a.source_link {
460428

461429
}
462430

463-
@media (prefers-color-scheme: dark) {
464-
:root {
465-
/* dark gruvbox theme colors */
466-
--bg_h: #1d2021;
467-
--bg: #282828;
468-
--bg_s: #32302f;
469-
--bg1: #3c3836;
470-
--bg2: #504945;
471-
--bg3: #665c54;
472-
--bg4: #7c6f64;
473-
474-
--fg: #fbf1c7;
475-
--fg1: #ebdbb2;
476-
--fg2: #d5c4a1;
477-
--fg3: #bdae93;
478-
--fg4: #a89984;
479-
480-
--red: #fb4934;
481-
--green: #b8bb26;
482-
--yellow: #fabd2f;
483-
--blue: #83a598;
484-
--purple: #d3869b;
485-
--aqua: #8ec07c;
486-
--gray: #928374;
487-
--orange: #fe8019;
488-
489-
--red-dim: #cc2412;
490-
--green-dim: #98971a;
491-
--yellow-dim: #d79921;
492-
--blue-dim: #458588;
493-
--purple-dim: #b16286;
494-
--aqua-dim: #689d6a;
495-
--gray-dim: #a89984;
496-
--orange-dim: #d65d0e;
497-
498-
/* odoc colors */
499-
--odoc-blue: #5c9cf5;
500-
--odoc-bg: #202020;
501-
--odoc-bg1: #252525;
502-
--odoc-fg: #bebebe;
503-
--odoc-fg1: #777;
504-
}
505-
}
506-
507-
:root {
431+
body.dark .source_container {
432+
/* dark gruvbox theme colors */
433+
--bg_h: #1d2021;
434+
--bg: #282828;
435+
--bg_s: #32302f;
436+
--bg1: #3c3836;
437+
--bg2: #504945;
438+
--bg3: #665c54;
439+
--bg4: #7c6f64;
440+
441+
--fg: #fbf1c7;
442+
--fg1: #ebdbb2;
443+
--fg2: #d5c4a1;
444+
--fg3: #bdae93;
445+
--fg4: #a89984;
446+
447+
--red: #fb4934;
448+
--green: #b8bb26;
449+
--yellow: #fabd2f;
450+
--blue: #83a598;
451+
--purple: #d3869b;
452+
--aqua: #8ec07c;
453+
--gray: #928374;
454+
--orange: #fe8019;
455+
456+
--red-dim: #cc2412;
457+
--green-dim: #98971a;
458+
--yellow-dim: #d79921;
459+
--blue-dim: #458588;
460+
--purple-dim: #b16286;
461+
--aqua-dim: #689d6a;
462+
--gray-dim: #a89984;
463+
--orange-dim: #d65d0e;
464+
465+
/* odoc colors */
466+
--odoc-blue: #5c9cf5;
467+
--odoc-bg: #202020;
468+
--odoc-bg1: #252525;
469+
--odoc-fg: #bebebe;
470+
--odoc-fg1: #777;
471+
}
472+
473+
474+
.source_container {
475+
--code-color: var(--fg);
476+
--code-background: var(--bg);
477+
508478
--source-link-color: var(--fg4);
509479
--source-line-column: var(--fg3);
510480
--source-line-column-bg: var(--bg_h);
@@ -522,6 +492,40 @@ a.source_link {
522492
}
523493

524494

495+
496+
/* Source links float inside preformated text or headings. */
497+
a.source_link {
498+
float: right;
499+
color: var(--source-link-color);
500+
font-family: "Fira Sans", sans-serif;
501+
font-size: initial;
502+
}
503+
504+
505+
.source_container {
506+
display: flex;
507+
padding: 0;
508+
}
509+
510+
.source_line_column {
511+
padding-right: 0.5em;
512+
text-align: right;
513+
color: var(--source-line-column);
514+
background: var(--source-line-column-bg);
515+
}
516+
517+
.source_line {
518+
padding: 0 1em;
519+
}
520+
521+
.source_code {
522+
flex-grow: 1;
523+
background: var(--code-background);
524+
padding: 0 0.3em;
525+
color: var(--code-color);
526+
}
527+
528+
525529
/* Linked highlight */
526530
.source_code *:target {
527531
border-radius: 1px;

0 commit comments

Comments
 (0)