Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ book:
repo-actions: [edit, issue]
chapters:
- index.qmd

- preface-2e.qmd
- intro.qmd

Expand Down Expand Up @@ -74,12 +73,27 @@ book:
format:
html:
theme:
- cosmo
- r4ds.scss
light: [cosmo, r4ds-light.scss]
dark: [cosmo, r4ds-dark.scss]
code-link: true

author-meta: "Hadley Wickham, Mine Çetinkaya-Rundel, and Garrett Grolemund"
include-in-header: "plausible.html"
include-in-header:
- plausible.html
- text: |
<script>
document.addEventListener('DOMContentLoaded', function() {
const theme = localStorage.getItem('quarto-color-scheme');
if (theme) document.body.setAttribute('data-theme', theme);
});
</script>
include-before-body:
- text: |
<div class="theme-toggle">
<button onclick="window.quartoToggleColorScheme()" class="theme-toggle-button">
<span class="theme-toggle-dark">🌙</span>
<span class="theme-toggle-light">☀️</span>
</button>
</div>
callout-appearance: simple

editor: source
35 changes: 35 additions & 0 deletions r4ds-dark.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// r4ds-dark.scss
/*-- scss:defaults --*/
$body-bg: #1a1a1a;
$body-color: #e6e6e6;
$link-color: #66b3ff;
$code-block-bg: #2d2d2d;

/*-- scss:rules --*/
.sidebar-title {
color: $body-color;
}

/* Theme toggle styles */
.theme-toggle {
position: fixed;
top: 1rem;
right: 1rem;
z-index: 1000;
}

.theme-toggle-button {
background: transparent;
border: none;
cursor: pointer;
padding: 0.5rem;
font-size: 1.2rem;
}

[data-theme="light"] .theme-toggle-dark {
display: none;
}

[data-theme="dark"] .theme-toggle-light {
display: none;
}
35 changes: 35 additions & 0 deletions r4ds-light.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// r4ds-light.scss
/*-- scss:defaults --*/
$body-bg: #ffffff;
$body-color: #404040;
$link-color: #0073e6;
$code-block-bg: #f8f9fa;

/*-- scss:rules --*/
.sidebar-title {
color: $body-color;
}

/* Theme toggle styles */
.theme-toggle {
position: fixed;
top: 1rem;
right: 1rem;
z-index: 1000;
}

.theme-toggle-button {
background: transparent;
border: none;
cursor: pointer;
padding: 0.5rem;
font-size: 1.2rem;
}

[data-theme="light"] .theme-toggle-dark {
display: none;
}

[data-theme="dark"] .theme-toggle-light {
display: none;
}