Repository navigation
Expand file tree
/
Copy pathcolorjam-objects.R
More file actions
155 lines (149 loc) · 4.89 KB
/
Copy pathcolorjam-objects.R
File metadata and controls
155 lines (149 loc) · 4.89 KB
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
#' Jam Linear Color Gradients
#'
#' Jam Linear Color Gradients that are color-blind-friendly.
#'
#' This data contains a `list` of linear/sequential color
#' gradients generated with
#' a multi-hue technique similar to that used by `RColorBrewer`
#' to expand the visual clarity of a linear single-hue color
#' gradient. Colors were chosed to avoid common color-blindness
#' problems, and to maximize visual differences between
#' color gradients.
#'
#' The colors in `jam_linear` are designed so that colors
#' in `jam_divergent` can be chosen for consistency.
#' For example linear color gradient `"firebrick"` can
#' be used to show coverage values, and `"skyblue_firebrick"`
#' can be used to show coverage difference from control,
#' and in both cases the maximum color is `"firebrick"`.
#'
#' These linear gradients are designed with a white background
#' color. Note the `jam_divergent` colors are designed with
#' a black background, intended to help indicate that these
#' colors are divergent.
#'
#' In general, there are seven warm color tones, and seven cool color
#' tones. Visual distinction is only expected between warm and
#' cool color tones, and is not distinct within the same color
#' tone.
#'
#' Each color is named by the closest corresponding R color:
#'
#' * firebrick
#' * orangered
#' * tomato
#' * sienna
#' * goldenrod
#' * gold
#' * skyblue
#' * dodgerblue
#' * royalblue
#' * slateblue
#' * orchid
#' * magenta
#' * maroon
#'
#' @family colorjam data
#'
#' @examples
#' data(jam_linear)
#' jamba::showColors(jam_linear)
#'
#' # show the same with dichromat adjustment
#' if (require(dichromat)) {
#' jamba::showColors(lapply(jam_linear, dichromat::dichromat))
#' }
#'
"jam_linear"
#' Jam Divergent Color Gradients
#'
#' Jam Divergent Color Gradients that are color-blind-friendly.
#'
#' This data contains a `list` of divergent color gradients generated
#' similar to `jam_linear` with multi-hue technique based upon
#' `RColorBrewer`. Each gradient is designed so that
#' the two colors are visibly distinct even under three
#' different color blindness simulations from `dichromat::dichromat()`.
#'
#' Each gradient is named by the closest corresponding R colors,
#' where the same names are used in `jam_linear` so that colors
#' can be matched where appropriate:
#'
#' * skyblue_firebrick
#' * dodgerblue_orangered
#' * royalblue_tomato
#' * slateblue_sienna
#' * orchid_orange
#' * magenta_goldenrod
#' * maroon_gold
#' * firebrick_skyblue
#' * orangered_dodgerblue
#' * tomato_royalblue
#' * sienna_slateblue
#' * orange_orchid
#' * goldenrod_magenta
#' * gold_maroon
#'
#' These linear gradients are designed with a white background
#' color.
#' These divergent gradients are designed with
#' a black background, intended to help indicate that these
#' colors are divergent. Note that linear gradients `jam_linear`
#' are designed with a white background color.
#'
#' @family colorjam data
#'
#' @examples
#' data(jam_divergent)
#' jamba::showColors(jam_divergent)
#'
#' # show the same with dichromat adjustment
#' if (require(dichromat)) {
#' jamba::showColors(lapply(jam_divergent, dichromat::dichromat))
#' }
#'
"jam_divergent"
#' named_colors from meodai/color-names and R colors()
#'
#' named_colors including 4507 entries from Git "meodai/color-names"
#' v11.0.0, and 436 entries from R `colors()`.
#'
#' @format a `character` vector with length 4943, containing
#' hexadecimal colors named with human-assigned color names.
#' Note that R colors are preceded by "R" in the name, for
#' example "Rgreen2", and only include colors not already
#' present in `"meodai/color-names"`.
#'
#' ## Processing
#'
#' Named colors were obtained from the amazing Github repository
#' [meodai/color-names](https://github.com/meodai/color-names).
#' This resource provided 30200 total named colors.
#' A subset of 4507 color names were denoted "good names" and were
#' included here.
#'
#' R colors from `grDevices::colors()` whose hex values were not already
#' included in the Meodai resource were added, after removing identical
#' hex colors such as `"darkred"` and `"red4"`.
#' These R colors were named with prefix `"R"` so labels such as
#' `"darkred"` became `"Rdarkred"`. The `"R"` prefix was used to avoid
#' name clashes, and to permit the Meodai color names to take precedence
#' whenever the same name was used in both resources.
#' The Meodai resource seemed visually preferable to similarly-named
#' R `grDevices::colors()` such as `"brown"`, and `"chartreuse"`,
#' however there could be benefit in using R color names since they
#' appear to match the W3C color name standard used by HTML and CSS.
#'
#' @source <https://github.com/meodai/color-names>
#'
#' @family colorjam data
#'
#' @examples
#' color_pie(unname(colorjam::named_colors))
#'
#' # subset for color chroma at least 30
#' colorjam::color_pie(unname(
#' colorjam::subset_colors(colorjam::named_colors, C >= 30)))
#' title(main="named_colors with C >= 30")
#'
"named_colors"