-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme_prevent.R
75 lines (71 loc) · 2.66 KB
/
theme_prevent.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
## Loading Google fonts (https://fonts.google.com/)
font_add_google("Noto Sans", "noto")
## Flama font with regular and italic font faces
font_add(family = "flama",
regular = "fonts/Flama-Font/Flama Regular.otf",
italic = "fonts/Flama-Font/Flama Italic.otf",
bold = "fonts/Flama-Font/FlamaBlack Regular.otf")
## Automatically use showtext to render text
showtext_auto()
prevent_green <- "#008332"
prevent_light_green <- "#76A100"
prevent_dark_blue <- "#003E6E"
prevent_blue <- "#005F89"
prevent_light_blue <- "#4398BA"
prevent_yellow <- "#FBB900"
prevent_red <- "#BE5014"
prevent_gray_red <- "#6C5861"
prevent_light_gray <- "#F0F0F0"
prevent_gray <- "#d3d3d3"
prevent_dark_gray <- "#3B3B3B"
prevent_turquoise <- "#009a9d"
prevent_green_comp <- "#D9ECE0"
prevent_light_green_comp <- "#DCE7BF"
prevent_dark_blue_comp <- "#BFCEDA"
prevent_blue_comp <- "#BFD7E1"
prevent_light_blue_comp <- "#D0E5EE"
prevent_yellow_comp <- "#FEEDBF"
prevent_red_comp <- "#EFD3C4"
prevent_green_contrast <- "#006632"
prevent_blue_contrast <- "#003E6E"
prevent_yellow_contrast <- "#FBD128"
prevent_red_contrast <- "#B01200"
prevent_gray_red_contrast <- "#68534E"
# manual palette creation, 7 colors
PREVENTpalette1 <- c("#6C5861", "#005F89", "#4398BA", "#76A100", "#008332", "#FBB900", "#FBD128")
# create palette with 12 colors based on Prevent colors above
PREVENTpalette2 <- colorRampPalette(colors = c("#6C5861", "#005F89", "#4398BA", "#76A100", "#008332", "#FBB900", "#FBD128"))(12)
theme_prevent <- function(fontfamily = "flama", axisTitleSize = 13, titlesize = 15,
margins = 12, axisface = "plain", stripsize = 12,
panelDist = 0.6, legendSize = 9, legendTsize = 10,
axisTextSize = 10, ...) {
theme(
text = element_text(family = fontfamily),
axis.title.x = element_text(
margin = margin(t = margins),
size = axisTitleSize
),
axis.title.y = element_text(
margin = margin(r = margins),
size = axisTitleSize
),
plot.title = element_text(
#family = "flama",
face = "bold",
size = titlesize
),
axis.title = element_text(
face = axisface
),
axis.text = element_text(size = axisTextSize),
plot.caption = element_text(
face = "italic"
),
legend.text = element_text(family = fontfamily, size = legendSize),
legend.title = element_text(family = fontfamily, size = legendTsize),
strip.text = element_text(size = stripsize),
panel.spacing = unit(panelDist, "cm", data = NULL),
legend.background = element_rect(color = "lightgrey"),
...
)
}