-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathusage.Rmd
60 lines (45 loc) · 1.34 KB
/
usage.Rmd
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
## Usage
For modularity, there are several stylesheets available.
If you just want foreground and background colors,
[download `r-colors.css`](dist/r-colors.css)
```r
download.file(
"https://pkg.garrickadenbuie.com/r-colors-css/dist/r-colors.css",
"r-colors.css"
)
```
and then add it to your HTML R Markdown documents
````markdown
output:
html_document:
css: r-colors.css
````
or your [xaringan](https://slides.yihui.org/xaringan) slides
````markdown
output:
xaringan::moon_reader:
css: r-colors.css
````
or just about anywhere else
```{r eval=FALSE}
htmltools::includeCSS("r-colors.css")
```
```{r echo=FALSE}
set.seed(44)
demo_color <- sample(colors(), 1)
```
Each of the
`r format(length(colors()), big.mark = ',')` colors
are available in few ways,
using the color name.
For example,
the R color named
`"`r demo_color`"`
is available
1. as a **foreground** color-setting class: <code>.`r demo_color`</code>
1. as a **background** color-setting class: <code>.bg-`r demo_color`</code>
1. [r-colors.vars.css](dist/r-colors.vars.css) provides each color
as a [css variable](https://developer.mozilla.org/en-US/docs/Web/CSS/--*): `var(--`r demo_color`)`
1. [r-colors.hover.css](dist/r-colors.hover.css) provides each color
as a foreground or background color-on-hover class:
`.`r demo_color`-hover` or `.bg-`r demo_color`-hover`