-
Notifications
You must be signed in to change notification settings - Fork 28
/
theme_template_variables.R
376 lines (360 loc) Β· 24 KB
/
theme_template_variables.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
#nocov start
template_variables <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description, ~ css_variable
, "text_color", "#000", "body", "Text Color", "--text_color"
, "header_color", "#000", "h1, h2, h3", "Header Color", "--header-color"
, "background_color", "#FFF", ".remark-slide-content", "Slide Background Color", "--background-color"
, "link_color", "rgb(249, 38, 114)", "a, a > code", "Link Color", "--link-color"
, "text_bold_color", "{NULL}", "strong", "Bold Text Color", "--text-bold-color"
, "text_slide_number_color", "{inverse_background_color}", ".remark-slide-number", "Slide Number Color", NA_character_
, "padding", "16px 64px 16px 64px", ".remark-slide-content", "Slide Padding in `top right [bottom left]` format", NA_character_
, "background_image", "{NULL}", ".remark-slide-content", "Background image applied to each *and every* slide. Set `title_slide_background_image = \"none\"` to remove the background image from the title slide", NA_character_
, "background_size", "{NULL}", ".remark-slide-content", "Background image size, requires `background_image` to be set. If `background_image` is set, `background_size` will default to `cover` so the background fills the screen. If both `background_image` and `background_position` are set, will default to 100 percent", NA_character_
, "background_position", "{NULL}", ".remark-slide-content", "Background image position, requires `background_image` to be set, and it is recommended to adjust `background_size`", NA_character_
, "code_highlight_color", "rgba(255,255,0,0.5)", ".remark-code-line-highlighted", "Code Line Highlight", "--code-highlight-color"
, "code_inline_color", "#000", ".remark-inline-code", "Inline Code Color", NA_character_
, "code_inline_background_color", "{NULL}", ".remark-inline-code", "Inline Code Background Color", NA_character_
, "code_inline_font_size", "1em", ".remark-inline-code", "Inline Code Text Font Size", "--code-inline-font-size"
, "inverse_background_color", "#272822", ".inverse", "Inverse Background Color", "--inverse-background-color"
, "inverse_text_color", "#d6d6d6", ".inverse", "Inverse Text Color", "--inverse-text-color"
, "inverse_text_shadow", "{FALSE}", ".inverse", "Enables Shadow on text of inverse slides", NA_character_
, "inverse_header_color", "#f3f3f3", ".inverse h1, .inverse h2, .inverse h3", "Inverse Header Color", "--inverse-header-color"
, "inverse_link_color", "{link_color}", ".inverse a, .inverse a > code", "Inverse Link Color", "--inverse-link-color"
, "title_slide_text_color", "{inverse_text_color}", ".title-slide", "Title Slide Text Color", "--title-slide-text-color"
, "title_slide_background_color", "{inverse_background_color}", ".title-slide", "Title Slide Background Color", "--title-slide-background-color"
, "title_slide_background_image", "{NULL}", ".title-slide", "Title Slide Background Image URL", NA_character_
, "title_slide_background_size", "{NULL}", ".title-slide", "Title Slide Background Image Size, defaults to \"cover\" if background image is set", NA_character_
, "title_slide_background_position", "{NULL}", ".title-slide", "Title Slide Background Image Position", NA_character_
, "footnote_color", "{NULL}", ".footnote", "Footnote text color (if `NA`, then it will be the same color as `text_color`)", NA_character_
, "footnote_font_size", "0.9em", ".footnote", "Footnote font size", NA_character_
, "footnote_position_bottom", "60px", ".footnote", "Footnote location from bottom of screen", NA_character_
, "left_column_subtle_color", "#777", ".left-column h2, .left-column h3", "Left Column Text (not last)", NA_character_
, "left_column_selected_color", "#000", ".left-column h2:last-of-type, .left-column h3:last-child", "Left Column Current Selection", NA_character_
, "blockquote_left_border_color", "lightgray", "blockquote", "Blockquote Left Border Color", NA_character_
, "table_border_color", "#666", "table: border-top, border-bottom", "Table top/bottom border", NA_character_
, "table_row_border_color", "#ddd", "table thead th: border-bottom", "Table row inner bottom border", NA_character_
, "table_row_even_background_color", "#eee", "thead, tfoot, tr:nth-child(even)", "Table Even Row Background Color", NA_character_
, "base_font_size", "20px", "html", "Base Font Size for All Slide Elements (must be `px`)", "--base-font-size"
, "text_font_size", "1rem", ".remark-slide-content", "Slide Body Text Font Size", "--text-font-size"
, "header_h1_font_size", "2.75rem", ".remark-slide-content h1", "h1 Header Text Font Size", "--header-h1-font-size"
, "header_h2_font_size", "2.25rem", ".remark-slide-content h2", "h2 Header Text Font Size", "--header-h2-font-size"
, "header_h3_font_size", "1.75rem", ".remark-slide-content h3", "h3 Header Text Font Size", "--header-h3-font-size"
, "header_background_auto", "{FALSE}", "", "Add background under slide title automatically for h1 header elements. If not enabled, use `class: header_background` to enable", NA_character_
, "header_background_color", "{header_color}", ".remark-slide-content h1", "Background Color for h1 Header with Background", "--header-background-color"
, "header_background_text_color", "{background_color}", ".remark-slide-content h1", "Text Color for h1 Header with Background", "--header-background-text-color"
, "header_background_padding", "{NULL}", ".remark-slide-content h1", "Padding for h1 Header with Background", NA_character_
, "header_background_content_padding_top", "7rem", ".remark-slide-content", "Top Padding for Content in Slide with Header with Background", NA_character_
, "header_background_ignore_classes", "{c('normal', 'inverse', 'title', 'middle', 'bottom')}", ".remark-slide-content", "Slide Classes Where Header with Background will not be Applied", NA_character_
, "text_slide_number_font_size", "0.9em", ".remark-slide-number", "Slide Number Text Font Size", NA_character_
, "text_font_google", "{NULL}", "body", "Use `google_font()` to specify body font", NA_character_
, "text_font_family", '{xaringanthemer_font_default("text_font_family")}', "body", "Body Text Font Family (xaringan default is `'Droid Serif'`)", "--text-font-family"
, "text_font_weight", '{xaringanthemer_font_default("text_font_weight")}', "body", "Body Text Font Weight", NA_character_
, "text_bold_font_weight", 'bold', "strong", "Body Bold Text Font Weight", NA_character_
, "text_font_url", '{xaringanthemer_font_default("text_font_url")}', "@import url()", "Body Text Font URL(s)", NA_character_
, "text_font_family_fallback", '{xaringanthemer_font_default("text_font_family_fallback")}', "body", "Body Text Font Fallbacks", "--text-font-family-fallback"
, "text_font_base", "sans-serif", "body", "Body Text Base Font (Total Failure Fallback)", "--text-font-base"
, "header_font_google", "{NULL}", "body", "Use `google_font()` to specify header font", NA_character_
, "header_font_family", '{xaringanthemer_font_default("header_font_family")}', "h1, h2, h3", "Header Font Family (xaringan default is `'Yanone Kaffeesatz'`)", "--header-font-family"
, "header_font_weight", '{xaringanthemer_font_default("header_font_weight")}', "h1, h2, h3", "Header Font Weight", NA_character_
, "header_font_family_fallback", 'Georgia, serif', "h1, h2, h3", "Header Font Family Fallback", "--header-font-family-fallback"
, "header_font_url", '{xaringanthemer_font_default("header_font_url")}', "@import url", "Header Font URL", NA_character_
, "code_font_google", "{NULL}", "body", "Use `google_font()` to specify code font", NA_character_
, "code_font_family", '{xaringanthemer_font_default("code_font_family")}', ".remark-code, .remark-inline-code", "Code Font Family", "--code-font-family"
, "code_font_size", "0.9rem", ".remark-inline", "Code Text Font Size", "--code-font-size"
, "code_font_url", '{xaringanthemer_font_default("code_font_url")}', "@import url", "Code Font URL", NA_character_
, "code_font_family_fallback", '{xaringanthemer_font_default("code_font_family_fallback")}', ".remark-code, .remark-inline-code", "Code Font Fallback", NA_character_
)
set_default <- function(tv, ..., set_var = "default") {
vars <- c(...)
for (var in names(vars)) {
tv[tv$variable == var, set_var] <- vars[var]
}
tv
}
template_variables$css_property <- NA_character_
mdn_font_size <- "[font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)"
mdn_font_weight <- "[font-weight](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight)"
mdn_background_size <- "[background-size](https://developer.mozilla.org/en-US/docs/Web/CSS/background-size)"
mdn_background_position <- "[background-position](https://developer.mozilla.org/en-US/docs/Web/CSS/background-position)"
mdn_padding <- "[padding](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)"
template_variables <- set_default(
template_variables,
set_var = "css_property",
padding = mdn_padding,
background_size = mdn_background_size,
background_position = mdn_background_position,
code_inline_font_size = mdn_font_size,
title_slide_background_position = mdn_background_position,
title_slide_background_size = mdn_background_size,
footnote_font_size = mdn_font_size,
footnote_position_bottom = "[position](https://developer.mozilla.org/en-US/docs/Web/CSS/position_value)",
text_font_size = mdn_font_size,
header_h1_font_size = mdn_font_size,
header_h2_font_size = mdn_font_size,
header_h3_font_size = mdn_font_size,
header_background_padding = mdn_padding,
text_slide_number_font_size = mdn_font_size,
text_font_weight = mdn_font_weight,
header_font_weight = mdn_font_weight,
code_font_size = mdn_font_size
)
template_mono_light <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description, ~ css_variable
, "base_color", "#23395b", "multiple", "Monotone base color, works best with a strong color", "--base"
, "white_color", "{lighten_color(base_color, 0.9)}", "multiple", "Brightest color used, default is a very light version of `base_color`", "--white"
, "black_color", "{darken_color(base_color, 0.3)}", "multiple", "Darkest color used, default is a very dark, version of `base_color`", "--black"
)
template_mono_light <- dplyr::bind_rows(template_mono_light, template_variables)
template_mono_light <- set_default(
template_mono_light,
text_color = "{black_color}",
header_color = "{base_color}",
background_color = "{white_color}",
link_color = "{base_color}",
text_bold_color = "{base_color}",
text_slide_number_color = "{base_color}",
code_inline_color = "{base_color}",
inverse_background_color = "{base_color}",
inverse_text_color = "{white_color}",
inverse_header_color = "{white_color}",
left_column_subtle_color = "{apply_alpha(base_color, 0.6)}",
left_column_selected_color = "{base_color}",
blockquote_left_border_color = "{apply_alpha(base_color, 0.5)}",
table_row_even_background_color = "{lighten_color(base_color, 0.8)}")
template_mono_dark <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description, ~ css_variable
, "base_color", "#cbf7ed", "multiple", "Monotone Base Color, works best with a light color.", "--base"
, "white_color", "{lighten_color(base_color, 0.8)}", "multiple", "Brightest color used, default is a very light version of `base_color`", "--white"
, "black_color", "{darken_color(base_color, 0.85)}", "multiple", "Darkest color used, default is a very dark, version of `base_color`", "--black"
)
template_mono_dark <- dplyr::bind_rows(template_mono_dark, template_variables)
template_mono_dark <- set_default(
template_mono_dark,
text_color = "{white_color}",
header_color = "{base_color}",
background_color = "{black_color}",
link_color = "{base_color}",
text_bold_color = "{base_color}",
text_slide_number_color = "{base_color}",
code_inline_color = "{base_color}",
inverse_background_color = "{base_color}",
inverse_text_color = "{black_color}",
inverse_header_color = "{black_color}",
left_column_subtle_color = "{apply_alpha(base_color, 0.6)}",
left_column_selected_color = "{base_color}",
blockquote_left_border_color = "{apply_alpha(base_color, 0.5)}",
table_row_even_background_color = "{darken_color(base_color, 0.7)}")
template_mono_accent <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description, ~ css_variable
, "base_color", "#43418A", "multiple", "Monotone Base Color, works best with a strong color", "--base"
, "white_color", "#FFFFFF", "multiple", "Brightest color used", "--white"
, "black_color", "#272822", "multiple", "Darkest color used", "--black"
)
template_mono_accent <- dplyr::bind_rows(template_mono_accent, template_variables)
template_mono_accent <- set_default(
template_mono_accent,
text_color = "{black_color}",
header_color = "{base_color}",
background_color = "{white_color}",
link_color = "{base_color}",
text_bold_color = "{base_color}",
text_slide_number_color = "{base_color}",
code_inline_color = "{base_color}",
inverse_background_color = "{base_color}",
inverse_text_color = "{white_color}",
inverse_header_color = "{white_color}",
left_column_subtle_color = "{apply_alpha(base_color, 0.6)}",
left_column_selected_color = "{base_color}",
blockquote_left_border_color = "{apply_alpha(base_color, 0.5)}",
table_row_even_background_color = "{lighten_color(base_color, 0.8)}")
template_mono_accent_inverse <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description, ~ css_variable
, "base_color", "#3C989E", "multiple", "Monotone Base Color, works best with a light color", "--base"
, "white_color", "#FFFFFF", "multiple", "Brightest color used, default is a very light version of `base_color`", "--white"
, "black_color", "{darken_color(base_color, 0.9)}", "multiple", "Darkest color used, default is a very dark, version of `base_color`", "--black"
)
template_mono_accent_inverse <- dplyr::bind_rows(template_mono_accent_inverse, template_variables)
template_mono_accent_inverse <- set_default(
template_mono_accent_inverse,
text_color = "{white_color}",
header_color = "{base_color}",
background_color = "{black_color}",
link_color = "{base_color}",
text_bold_color = "{base_color}",
text_slide_number_color = "{base_color}",
code_inline_color = "{base_color}",
inverse_background_color = "{base_color}",
inverse_text_color = "{black_color}",
inverse_header_color = "{black_color}",
left_column_subtle_color = "{apply_alpha(base_color, 0.6)}",
left_column_selected_color = "{base_color}",
blockquote_left_border_color = "{apply_alpha(base_color, 0.5)}",
table_row_even_background_color = "{darken_color(base_color, 0.8)}")
template_duo_light <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description, ~ css_variable
, "primary_color", "#1F4257", "multiple", "Duotone Secondary Color", "--primary"
, "secondary_color", "#F97B64", "multiple", "Duotone Primary Color", "--secondary"
, "white_color", "{lighten_color(primary_color, 0.99)}", "multiple", "Brightest color used, default is a very light version of `primary_color`", "--white"
, "black_color", "{darken_color(secondary_color, 0.9)}", "multiple", "Darkest color used, default is a very dark version of `secondary_color`", "--black"
)
template_duo_light <- dplyr::bind_rows(template_duo_light, template_variables)
template_duo_light <- set_default(
template_duo_light,
text_color = "{black_color}",
header_color = "{primary_color}",
background_color = "{white_color}",
link_color = "{secondary_color}",
text_bold_color = "{secondary_color}",
text_slide_number_color = "{primary_color}",
code_inline_color = "{secondary_color}",
inverse_background_color = "{primary_color}",
inverse_text_color = "{secondary_color}",
inverse_header_color = "{secondary_color}",
left_column_subtle_color = "{apply_alpha(secondary_color, 0.6)}",
left_column_selected_color = "{secondary_color}",
blockquote_left_border_color = "{apply_alpha(secondary_color, 0.5)}",
table_row_even_background_color = "{lighten_color(secondary_color, 0.9)}")
template_duo <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description, ~ css_variable
, "primary_color", "#1F4257", "multiple", "Duotone Primary Color", "--primary"
, "secondary_color", "#F97B64", "multiple", "Duotone Secondary Color", "--secondary"
)
template_duo <- dplyr::bind_rows(template_duo, template_variables)
template_duo <- set_default(
template_duo,
text_color = "{choose_dark_or_light(primary_color, darken_color(primary_color, 0.9), lighten_color(secondary_color, 0.99))}",
header_color = "{secondary_color}",
background_color = "{primary_color}",
link_color = "{secondary_color}",
text_bold_color = "{secondary_color}",
text_slide_number_color = "{text_color}",
code_inline_color = "{secondary_color}",
inverse_background_color = "{secondary_color}",
inverse_text_color = "{primary_color}",
inverse_header_color = "{primary_color}",
title_slide_text_color = "{secondary_color}",
title_slide_background_color = "{primary_color}",
left_column_subtle_color = "{apply_alpha(secondary_color, 0.6)}",
left_column_selected_color = "{secondary_color}",
blockquote_left_border_color = "{apply_alpha(secondary_color, 0.5)}",
table_row_even_background_color = "{lighten_color(primary_color, 0.9)}")
template_duo_accent <- tibble::tribble(
~ variable, ~ default, ~ element, ~ description, ~ css_variable
, "primary_color", "#035AA6", "multiple", "Duotone Primary Color", "--primary"
, "secondary_color", "#03A696", "multiple", "Duotone Secondary Color", "--secondary"
, "white_color", "#FFFFFF", "multiple", "Brightest color used", "--white"
, "black_color", "#000000", "multiple", "Darkest color used", "--black"
)
template_duo_accent <- dplyr::bind_rows(template_duo_accent, template_variables)
template_duo_accent <- set_default(
template_duo_accent,
text_color = "{black_color}",
header_color = "{primary_color}",
background_color = "{white_color}",
link_color = "{choose_dark_or_light(secondary_color, primary_color, secondary_color)}",
text_bold_color = "{choose_dark_or_light(secondary_color, primary_color, secondary_color)}",
text_slide_number_color = "{primary_color}",
code_inline_color = "{choose_dark_or_light(secondary_color, primary_color, secondary_color)}",
inverse_background_color = "{secondary_color}",
inverse_text_color = "{choose_dark_or_light(secondary_color, black_color, white_color)}",
inverse_header_color = "{choose_dark_or_light(secondary_color, black_color, white_color)}",
title_slide_background_color = "{primary_color}",
title_slide_text_color = "{choose_dark_or_light(primary_color, black_color, white_color)}",
left_column_subtle_color = "{apply_alpha(primary_color, 0.6)}",
left_column_selected_color = "{primary_color}",
blockquote_left_border_color = "{apply_alpha(secondary_color, 0.5)}",
table_row_even_background_color = "{lighten_color(secondary_color, 0.8)}")
template_duo_accent_inverse <- set_default(
template_duo_accent,
text_color = "{white_color}",
header_color = "{primary_color}",
background_color = "{black_color}",
link_color = "{choose_dark_or_light(secondary_color, secondary_color, primary_color)}",
text_bold_color = "{choose_dark_or_light(secondary_color, secondary_color, primary_color)}",
text_slide_number_color = "{primary_color}",
code_inline_color = "{choose_dark_or_light(secondary_color, secondary_color, primary_color)}",
inverse_background_color = "{secondary_color}",
inverse_text_color = "{choose_dark_or_light(secondary_color, black_color, white_color)}",
inverse_header_color = "{choose_dark_or_light(secondary_color, black_color, white_color)}",
title_slide_background_color = "{primary_color}",
title_slide_text_color = "{choose_dark_or_light(primary_color, black_color, white_color)}",
left_column_subtle_color = "{apply_alpha(primary_color, 0.6)}",
left_column_selected_color = "{primary_color}",
blockquote_left_border_color = "{apply_alpha(secondary_color, 0.5)}",
table_row_even_background_color = "{darken_color(choose_dark_or_light(primary_color, secondary_color, primary_color), 0.2)}")
solarized <- list(
"base03" = "#002b36",
"base02" = "#073642",
"base01" = "#586e75",
"base00" = "#657b83",
"base0" = "#839496",
"base1" = "#93a1a1",
"base2" = "#eee8d5",
"base3" = "#fdf6e3",
"yellow" = "#b58900",
"orange" = "#cb4b16",
"red" = "#dc322f",
"magenta" = "#d33682",
"violet" = "#6c71c4",
"blue" = "#268bd2",
"cyan" = "#2aa198",
"green" = "#859900")
template_solarized_light <- set_default(
template_variables,
text_color = solarized$base00,
header_color = solarized$red,
background_color = solarized$base3,
link_color = solarized$yellow,
text_bold_color = solarized$magenta,
text_slide_number_color = solarized$base1,
code_highlight_color = "#268bd240", #xaringanthemer:::apply_alpha(solarized$blue, 0.25)
code_inline_color = solarized$violet,
inverse_background_color = solarized$base03,
inverse_text_color = solarized$base3,
inverse_header_color = "{inverse_text_color}",
title_slide_text_color = "{inverse_text_color}",
title_slide_background_color = "{inverse_background_color}",
left_column_subtle_color = solarized$base1,
left_column_selected_color = solarized$base01,
blockquote_left_border_color = solarized$orange,
table_border_color = solarized$base0,
table_row_border_color = solarized$base0,
table_row_even_background_color = solarized$base2
)
template_solarized_dark <- set_default(
template_variables,
text_color = solarized$base0,
header_color = solarized$red,
background_color = solarized$base03,
link_color = solarized$yellow,
text_bold_color = solarized$magenta,
text_slide_number_color = solarized$base01,
code_highlight_color = "#268bd240", #xaringanthemer:::apply_alpha(solarized$blue, 0.25)
code_inline_color = solarized$violet,
inverse_background_color = solarized$base3,
inverse_text_color = solarized$base03,
inverse_header_color = "{inverse_text_color}",
title_slide_text_color = "{inverse_text_color}",
title_slide_background_color = "{inverse_background_color}",
left_column_subtle_color = solarized$base01,
left_column_selected_color = solarized$base1,
blockquote_left_border_color = solarized$orange,
table_border_color = solarized$base00,
table_row_border_color = solarized$base00,
table_row_even_background_color = solarized$base02
)
usethis::use_data(
template_variables,
template_mono_accent,
template_mono_accent_inverse,
template_mono_light,
template_mono_dark,
template_duo,
template_duo_light,
template_duo_accent,
template_duo_accent_inverse,
template_solarized_light,
template_solarized_dark,
internal = TRUE,
overwrite = TRUE
)