Skip to content

Commit

Permalink
2211 darkmode
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanrongen committed Nov 22, 2024
1 parent 5c89399 commit 30e8d20
Show file tree
Hide file tree
Showing 15 changed files with 35,877 additions and 34,790 deletions.
37 changes: 37 additions & 0 deletions _extensions/gadenbuie/auto-dark/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# MODIFIED SOURCE -----------------------------------------------------------

Copyright (C) 2024 Garrick Aden-Buie
AGPL v3: https://www.gnu.org/licenses/agpl-3.0.en.html

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.


# ORIGINAL SOURCE -----------------------------------------------------------
# https://ar.al/2021/08/24/implementing-dark-mode-in-a-handful-of-lines-of-css-with-css-filters/

Copyright (C) 2021 Aral Balkan
AGPL v3: https://www.gnu.org/licenses/agpl-3.0.en.html

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
8 changes: 8 additions & 0 deletions _extensions/gadenbuie/auto-dark/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Auto Dark Mode
author: Garrick Aden-Buie
version: 1.0.0
quarto-required: ">=1.4.0"
contributes:
filters:
- auto-dark.lua

52 changes: 52 additions & 0 deletions _extensions/gadenbuie/auto-dark/auto-dark-mode.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* Auto Dark Mode for Quarto
*
* https://github.com/gadenbuie/quarto-auto-dark
*
* License: Affero GPL v3, https://www.gnu.org/licenses/agpl-3.0.en.html
* Original: Aral Balkan
* https://ar.al/2021/08/24/implementing-dark-mode-in-a-handful-of-lines-of-css-with-css-filters/
*
* Modified: Garrick Aden-Buie
*
*/
@media (prefers-color-scheme: dark) {
/* Invert all elements on the body while attempting to not alter the hue substantially. */
body {
filter: invert(100%) hue-rotate(180deg);
}

/* Workarounds and optical adjustments. */

/*
Firefox workaround: Set the background colour for the html
element separately because, unlike other browsers, Firefox
doesn't apply the filter to the root element's background.
*/
html {
background-color: #111;
}

/* Do not invert media (revert the invert). */
img, video, iframe, svg:not(.bi, .fa) {
filter: invert(100%) hue-rotate(180deg);
}

/*
Videos running fullscreen are no longer affected by the
filter on the body so we need to also unset the
revert we applied earlier so we're left with no filter again.
*/
video:fullscreen {
filter: none;
}

/* Re-enable code block backgrounds. */
pre {
filter: invert(10%);
}

/* Re-enable source code block backgrounds. */
div.sourceCode {
filter: invert(10%);
}
}
9 changes: 9 additions & 0 deletions _extensions/gadenbuie/auto-dark/auto-dark.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function Pandoc()
if quarto.doc.is_format("html:js") then
quarto.doc.add_html_dependency({
name = "quarto-auto-dark-mode",
version = "1.0.0",
stylesheets = {"auto-dark-mode.css"}
})
end
end
4 changes: 2 additions & 2 deletions _freeze/materials/04-plotting/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"hash": "d4a131e91826a1b7c0f7e8f521c61159",
"hash": "745894eb74ce2359bb9cfa4c3181e1cb",
"result": {
"engine": "knitr",
"markdown": "---\ntitle: Plotting data\n---\n\n\n\n\n::: {.callout-tip}\n#### Learning objectives\n\n- \n:::\n\n## Context\nWe now have a good grasp of how data is commonly structured, with variables in columns and observations in rows. This is the perfect format for visualising data.\n\n## Introducing plotting\n\nTo create a plot we'll need three things:\n\n1. data\n2. mapping aesthetics\n3. specify the type of plot\n\n::: {.panel-tabset group=\"language\"}\n## R\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code code-line-numbers=\"2\"}\nlibrary(tidyverse)\n```\n\n::: {.cell-output .cell-output-stderr}\n\n```\n── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──\n✔ dplyr 1.1.4 ✔ readr 2.1.5\n✔ forcats 1.0.0 ✔ stringr 1.5.1\n✔ ggplot2 3.5.1 ✔ tibble 3.2.1\n✔ lubridate 1.9.3 ✔ tidyr 1.3.1\n✔ purrr 1.0.2 \n── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──\n✖ dplyr::filter() masks stats::filter()\n✖ dplyr::lag() masks stats::lag()\nℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors\n```\n\n\n:::\n\n```{.r .cell-code code-line-numbers=\"2\"}\nsurveys <- read_csv(\"data/surveys.csv\")\n```\n\n::: {.cell-output .cell-output-stderr}\n\n```\nRows: 34786 Columns: 13\n── Column specification ────────────────────────────────────────────────────────\nDelimiter: \",\"\nchr (6): species_id, sex, genus, species, taxa, plot_type\ndbl (7): record_id, month, day, year, plot_id, hindfoot_length, weight\n\nℹ Use `spec()` to retrieve the full column specification for this data.\nℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.\n```\n\n\n:::\n\n```{.r .cell-code code-line-numbers=\"2\"}\nggplot(data = surveys,\n mapping = aes(x = weight, y = hindfoot_length)) +\n geom_point()\n```\n\n::: {.cell-output .cell-output-stderr}\n\n```\nWarning: Removed 4048 rows containing missing values or values outside the scale range\n(`geom_point()`).\n```\n\n\n:::\n\n::: {.cell-output-display}\n![](04-plotting_files/figure-html/unnamed-chunk-1-1.png){width=672}\n:::\n:::\n\n\n\n\n## Python\n\n:::\n\n### Start plotting\n* LO: plotting with ggplot2\n\n### Building up plots\n* LO: layering plots\n\n### Changing plots\n* LO: changing aesthetics (colour, fill, transparency, size)\n\n\n\n## Summary\n\n::: {.callout-tip}\n#### Key points\n\n- \n:::\n",
"markdown": "---\ntitle: Plotting data\n---\n\n\n\n\n::: {.callout-tip}\n#### Learning objectives\n\n- \n:::\n\n## Context\nWe now have a good grasp of how data is commonly structured, with variables in columns and observations in rows. This is the perfect format for visualising data.\n\n## Introducing plotting\n\nTo create a plot we'll need three things:\n\n1. data\n2. mapping aesthetics\n3. specify the type of plot\n\n::: {.panel-tabset group=\"language\"}\n## R\n\n\n## Python\n\n:::\n\n### Start plotting\n* LO: plotting with ggplot2\n\n### Building up plots\n* LO: layering plots\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(tidyverse)\n\nsurveys <- read_csv(\"data/surveys.csv\")\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nggplot(data = surveys,\n mapping = aes(x = weight, y = hindfoot_length)) +\n geom_point()\n```\n\n::: {.cell-output-display}\n![](04-plotting_files/figure-html/unnamed-chunk-2-1.png){width=672}\n:::\n:::\n\n\n\n\n### Changing plots\n* LO: changing aesthetics (colour, fill, transparency, size)\n\n\n\n## Summary\n\n::: {.callout-tip}\n#### Key points\n\n- \n:::\n",
"supporting": [
"04-plotting_files"
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ project:
- materials/*
- "!materials/*/no_render"

format: courseformat-html
format:
courseformat-html:
theme: flatly

exercises:
number: true
hide-answers: false

filters:
- courseformat
- auto-dark

execute:
freeze: auto
Expand Down
16 changes: 16 additions & 0 deletions materials/04-plotting.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ To create a plot we'll need three things:
### Building up plots
* LO: layering plots

```{r}
#| message: false
library(tidyverse)
surveys <- read_csv("data/surveys.csv")
```


```{r}
#| warning: false
ggplot(data = surveys,
mapping = aes(x = weight, y = hindfoot_length)) +
geom_point()
```

### Changing plots
* LO: changing aesthetics (colour, fill, transparency, size)

Expand Down
119 changes: 119 additions & 0 deletions materials/data/patients.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
patient_id,systolic_pressure,heart_rate,weight_kg,age,diabetic
N8805,113,NA,132.84,46,yes
N6558,85,NA,137.6,61,yes
N5556,89,48,131.66,31,yes
N2297,67,31,129.78,37,yes
N7318,154,118,84.78,61,yes
N6378,78,34,78.41,52,yes
N3615,102,75,131.97,40,yes
N9260,95,50,83.7,42,yes
N6710,159,124,127.76,37,yes
N0327,124,97,82.48,39,yes
N2729,113,82,128.07,44,yes
N3727,NA,77,119.39,42,yes
N4053,NA,102,126.92,57,yes
N9763,100,66,122.34,37,yes
N9370,86,56,88.51,52,yes
N3105,100,71,80.02,40,yes
N9493,147,118,122.74,34,yes
N9740,124,86,83.47,33,yes
N8578,118,87,106.43,36,yes
N2269,104,77,87.71,51,yes
N6540,104,67,124.81,34,yes
N8825,42,3,96.7,63,yes
N7768,82,47,118.4,44,yes
N7594,94,60,111.8,32,yes
N3321,103,80,106.74,44,yes
N3908,107,67,124.19,48,yes
N9885,97,69,81.97,58,yes
N5679,84,52,94.88,44,yes
N0492,136,98,96.19,57,yes
N9240,113,85,127.16,48,yes
N5541,107,93,126.02,43,yes
N9229,117,77,82.82,52,yes
N0768,93,66,124.57,41,yes
N2449,109,72,130.75,48,yes
N4585,NA,50,100.19,48,yes
N1874,NA,51,101.88,54,yes
N3514,117,86,105.35,57,yes
N1652,107,75,NA,39,yes
N0905,110,77,111,32,yes
N9827,93,52,111.67,33,yes
N0834,118,85,136.79,35,yes
N9997,85,51,79.67,50,yes
N9535,115,79,114.03,45,yes
N2257,86,NA,110.88,44,yes
N5462,135,103,96.03,42,yes
N5239,111,68,115.97,50,yes
N2877,79,45,117.45,39,yes
N5530,79,45,78.17,30,yes
N4203,110,78,108.83,48,yes
N4969,109,55,95.98,58,yes
N1967,127,107,113.35,38,yes
N8417,NA,NA,79.52,32,yes
N6410,88,48,92.52,34,yes
N2877,97,66,NA,27,yes
N9238,84,49,116.07,43,yes
N7212,121,90,104.29,43,yes
N9349,118,89,NA,59,yes
N0467,85,57,115.35,23,yes
N0621,104,69,116.82,33,yes
N0205,76,59,107.79,48,no
N6888,93,80,72.39,61,no
N4083,90,61,96.14,54,no
N9464,85,59,75.38,43,no
N7081,119,80,68.97,36,no
N3923,94,71,86.64,41,no
N7134,103,65,62.9,55,no
N8136,127,90,54.11,43,no
N5784,85,55,115.02,58,no
N5147,91,74,55.34,46,no
N8283,70,54,57.05,42,no
N9819,114,67,83.35,45,no
N2010,87,64,96.96,46,no
N2947,92,65,68.18,41,no
N3321,68,NA,91.82,40,no
N3918,99,NA,NA,55,no
N0936,79,51,71.75,36,no
N2960,69,53,106.67,41,no
N5935,96,77,110.95,47,no
N0142,87,72,100.01,38,no
N3181,94,79,79.38,53,no
N5442,92,58,75.09,43,no
N0926,101,60,98.7,41,no
N9785,102,81,66.85,37,no
N8086,99,70,97.93,46,no
N8125,134,79,52.75,31,no
N1462,69,59,102.41,53,no
N9748,88,46,101.17,52,no
N3518,91,49,NA,45,no
N2987,55,51,59.45,51,no
N1296,117,74,65.16,42,no
N3078,76,53,61.49,69,no
N4111,65,58,76.66,50,no
N9348,85,53,76.78,32,no
N8166,102,68,115.75,51,no
N4498,85,51,75.77,54,no
N6176,100,51,53.03,41,no
N9995,59,48,111.25,55,no
N0445,102,69,NA,51,no
N1699,126,76,58.78,37,no
N8807,82,64,100.09,30,no
N5871,79,54,86.5,45,no
N8369,128,76,63.83,38,no
N0487,94,57,53.92,40,no
N7382,97,72,NA,33,no
N9838,80,68,78.05,39,no
N2303,91,55,92.81,44,no
N7620,79,NA,64.88,47,no
N6609,82,62,98.83,44,no
N1186,50,46,113.33,33,no
N9751,115,92,75.42,52,no
N2265,NA,77,92.5,56,no
N8156,79,47,89.68,34,no
N7870,50,45,115.07,46,no
N6467,NA,82,52.57,44,no
N4159,110,84,75.99,53,no
N4453,96,74,105.11,33,no
N4513,71,65,59.39,50,no
N7071,92,72,58.77,60,no
25 changes: 25 additions & 0 deletions materials/data/plots.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
plot_id,plot_type
1,Spectab exclosure
2,Control
3,Long-term Krat Exclosure
4,Control
5,Rodent Exclosure
6,Short-term Krat Exclosure
7,Rodent Exclosure
8,Control
9,Spectab exclosure
10,Rodent Exclosure
11,Control
12,Control
13,Short-term Krat Exclosure
14,Control
15,Long-term Krat Exclosure
16,Rodent Exclosure
17,Control
18,Short-term Krat Exclosure
19,Long-term Krat Exclosure
20,Short-term Krat Exclosure
21,Long-term Krat Exclosure
22,Control
23,Rodent Exclosure
24,Rodent Exclosure
55 changes: 55 additions & 0 deletions materials/data/species.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
species_id,genus,species,taxa
AB,Amphispiza,bilineata,Bird
AH,Ammospermophilus,harrisi,Rodent
AS,Ammodramus,savannarum,Bird
BA,Baiomys,taylori,Rodent
CB,Campylorhynchus,brunneicapillus,Bird
CM,Calamospiza,melanocorys,Bird
CQ,Callipepla,squamata,Bird
CS,Crotalus,scutalatus,Reptile
CT,Cnemidophorus,tigris,Reptile
CU,Cnemidophorus,uniparens,Reptile
CV,Crotalus,viridis,Reptile
DM,Dipodomys,merriami,Rodent
DO,Dipodomys,ordii,Rodent
DS,Dipodomys,spectabilis,Rodent
DX,Dipodomys,sp.,Rodent
EO,Eumeces,obsoletus,Reptile
GS,Gambelia,silus,Reptile
NL,Neotoma,albigula,Rodent
NX,Neotoma,sp.,Rodent
OL,Onychomys,leucogaster,Rodent
OT,Onychomys,torridus,Rodent
OX,Onychomys,sp.,Rodent
PB,Chaetodipus,baileyi,Rodent
PC,Pipilo,chlorurus,Bird
PE,Peromyscus,eremicus,Rodent
PF,Perognathus,flavus,Rodent
PG,Pooecetes,gramineus,Bird
PH,Perognathus,hispidus,Rodent
PI,Chaetodipus,intermedius,Rodent
PL,Peromyscus,leucopus,Rodent
PM,Peromyscus,maniculatus,Rodent
PP,Chaetodipus,penicillatus,Rodent
PU,Pipilo,fuscus,Bird
PX,Chaetodipus,sp.,Rodent
RF,Reithrodontomys,fulvescens,Rodent
RM,Reithrodontomys,megalotis,Rodent
RO,Reithrodontomys,montanus,Rodent
RX,Reithrodontomys,sp.,Rodent
SA,Sylvilagus,audubonii,Rabbit
SB,Spizella,breweri,Bird
SC,Sceloporus,clarki,Reptile
SF,Sigmodon,fulviventer,Rodent
SH,Sigmodon,hispidus,Rodent
SO,Sigmodon,ochrognathus,Rodent
SS,Spermophilus,spilosoma,Rodent
ST,Spermophilus,tereticaudus,Rodent
SU,Sceloporus,undulatus,Reptile
SX,Sigmodon,sp.,Rodent
UL,Lizard,sp.,Reptile
UP,Pipilo,sp.,Bird
UR,Rodent,sp.,Rodent
US,Sparrow,sp.,Bird
ZL,Zonotrichia,leucophrys,Bird
ZM,Zenaida,macroura,Bird
Loading

0 comments on commit 30e8d20

Please sign in to comment.