Skip to content

Commit 046da44

Browse files
authored
[Enhancements] More style changes (#9)
* update styling defaults * update quarto defaults to use new styling * fix formatting of dark theme heading in `_quarto.yml` * fix overflow rendering
1 parent ba88b87 commit 046da44

4 files changed

Lines changed: 79 additions & 26 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Keeping Knit html files out
22
*.html
33

4-
54
# Keeping Data out of the Repo
65
data/raw/*
76
!data/raw/.gitkeep
@@ -63,3 +62,6 @@ rsconnect/
6362

6463
/.quarto/
6564
**/*.quarto_ipynb
65+
66+
# ignore .editorconfig
67+
/.editorconfig

_quarto.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ format:
1515
light:
1616
- ./custom.scss
1717
dark:
18-
- darkly
1918
- ./custom.scss
19+
- ./custom-dark.scss
2020
pdf:
2121
margin-left: 20mm
2222
margin-top: 30mm

custom-dark.scss

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*-- scss:defaults --*/
2+
$gray-800: #444 !default;
3+
$gray-900: #222 !default;
4+
$white: #fff !default;
5+
6+
$body-bg: $gray-900 !default;
7+
$body-color: $white !default;
8+
9+
// code
10+
$code-color: $gray-800 !default;
11+
$pre-color: inherit !default;
12+
13+
/*-- scss:rules --*/
14+
15+
@include color-mode(dark) {}
16+
17+
// source code
18+
pre.sourceCode {
19+
background-color: #444;
20+
}
21+
22+
.code-copy-button:hover {
23+
& .bi::before {
24+
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#{colorToRGBA($syndemics-pink)}" viewBox="0 0 16 16"><path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/><path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/></svg>') !important;
25+
}
26+
}

custom.scss

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
/*-- scss:uses --*/
2-
3-
/*-- scss:functions --*/
4-
51
/*-- scss:defaults --*/
62

73
// fonts
8-
$font-family-sans-serif: "Helvetica", "Red Hat Display", sans-serif !default;
4+
$font-size-root: null !default;
5+
$font-size-base: 1rem !default;
6+
$font-family-sans-serif: system-ui, -apple-system, "Helvetica", "Red Hat Display", sans-serif !default;
97
$font-family-monospace: "Courier New", "Consolas", monospace !default;
10-
118
$headings-font-weight: 500 !default;
129

1310
// colors
@@ -23,12 +20,11 @@ $primary: $syndemics-blue !default;
2320
$secondary: $syndemics-cyan !default;
2421
$light: $background-light !default;
2522
$dark: $background-dark !default;
23+
$link-color: $syndemics-pink !default;
2624

2725
// options
2826
$enable-rounded: true !default;
2927

30-
/*-- scss:mixins --*/
31-
3228
/*-- scss:rules --*/
3329

3430
:root {
@@ -37,24 +33,34 @@ $enable-rounded: true !default;
3733
}
3834

3935
body.quarto-light {
40-
--bs-link-hover-color-rgb: #{colorToRGBA(#3d9be9)};
41-
h1,.h1,h2,.h2 {
36+
--bs-heading-color: var(--bs-heading-color-light);
37+
38+
h1, .h1, h2, .h2 {
4239
color: var(--bs-heading-color-light);
4340
}
4441
}
4542

4643
body.quarto-dark {
47-
--bs-link-color-rgb: #{colorToRGBA(#f0325f)};
48-
--bs-link-hover-color-rgb: #{colorToRGBA(#3d9be9)};
49-
h1,.h1,h2,.h2 {
44+
--bs-heading-color: var(--bs-heading-color-dark);
45+
46+
h1, .h1, h2, .h2 {
5047
color: var(--bs-heading-color-dark);
5148
}
5249
}
5350

54-
h1.title,.title.h1 {
51+
h1.title, .title.h1 {
5552
font-size: calc(1.5rem + 0.9vw);
5653
}
5754

55+
// color toggle icon
56+
.quarto-color-scheme-toggle {
57+
position: fixed;
58+
59+
.bi::before, .alternate .bi::before {
60+
transition: background-image 0.5s;
61+
}
62+
}
63+
5864
#TOC {
5965
font-weight: 600;
6066

@@ -69,10 +75,13 @@ h1.title,.title.h1 {
6975
}
7076
}
7177

78+
.nav-link {
79+
transition: unset;
80+
}
81+
7282
.nav-link:not(:hover) {
7383
color: inherit !important;
7484
border-left: solid 1px var(--bs-body-color);
75-
transition: color 0.5s;
7685
}
7786

7887
.nav-link:hover {
@@ -85,15 +94,9 @@ h1.title,.title.h1 {
8594
font-weight: 600 !important;
8695
}
8796

97+
// table style
8898
.table {
89-
& > tbody {
90-
border: 2px solid;
91-
}
92-
93-
& col:not(:last-of-type) {
94-
border-right: 2px solid;
95-
}
96-
99+
// heading
97100
& tr:first-of-type {
98101
background-color: var(--bs-heading-color-dark);
99102
font-weight: 600;
@@ -104,16 +107,38 @@ h1.title,.title.h1 {
104107
color: black;
105108
}
106109
}
110+
111+
// table rules
112+
& > tbody {
113+
border: 2px solid;
114+
}
115+
116+
& col:not(:last-of-type) {
117+
border-right: 2px solid;
118+
}
119+
120+
& > caption {
121+
font-weight: 600;
122+
color: var(--bs-heading-color);
123+
}
124+
}
125+
126+
figcaption {
127+
font-weight: 600;
128+
color: var(--bs-heading-color);
129+
text-align: center;
107130
}
108131

132+
// source code style
109133
pre code {
110134
font-weight: 600;
111135
}
112136

113137
pre:not(.sourceCode) {
114138
border: 1px #ccc solid;
115139
border-radius: 5px;
116-
overflow: visible;
140+
overflow-x: clip;
141+
overflow-y: visible;
117142

118143
&:before {
119144
position: relative;

0 commit comments

Comments
 (0)