-
Notifications
You must be signed in to change notification settings - Fork 12
/
Cardiff.R
218 lines (185 loc) · 6.74 KB
/
Cardiff.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
## Cardiff.R | 2023 09 25
## Colors of the Cardiff University, Wales, UK
## -------------------------------------------
# Information: ------
# cur_pals: "cardiff_1", "cardiff_2" (2)
# inst: "Cardiff University"
# inst_alt: "Prifysgol Caerdydd"
# inst_URL: <https://www.cardiff.ac.uk>
# country: Wales, UK
# Color source:
# color_URL: User Experience Style Guide (V2 : 04/06/2013) at
# <https://docplayer.net/2342536-Cardiff-university-user-experience-style-guide.html>
# Last check: 2023-09-10
# Author information:
# unicol, 2023-09-10
# Colors: ------
# Color definitions:
# 1: Primary Colour Palette (p. 8) ----
#
# The primary Cardiff University colour palette should be used consistently
# throughout it’s application of the User Experience Style Guidelines.
#
# HEX \code{"#d3374a"} R:211 G: 55 B: 74
# HEX \code{"#d3d3d2"} R:211 G:211 B:210
# HEX \code{"#22211f"} R: 34 G: 33 B: 31
# HEX \code{"#ffffff"} R:255 G:255 B:255
c_1 <- "#d3374a"
c_2 <- "#d3d3d2"
c_3 <- "#22211f"
c_4 <- "#ffffff"
# Tints (p. 9)
#
# The primary Cardiff University colour palette contains a spectrum of tints
# from light to dark grey. These can be used mainly as graphical backgrounds,
# button overstates etc.
#
# 1 HEX \code{"#e9e9e9"}
# 2 HEX \code{"#d0d0cf"}
# 3 HEX \code{"#bcbbbb"}
# 4 HEX \code{"#91908f"}
# 5 HEX \code{"#7a7978"}
# 6 HEX \code{"#666564"}
# 7 HEX \code{"#373736"}
# 8 HEX \code{"#22211f"}
t_1 <- "#e9e9e9"
t_2 <- "#d0d0cf"
t_3 <- "#bcbbbb"
t_4 <- "#91908f"
t_5 <- "#7a7978"
t_6 <- "#666564"
t_7 <- "#373736"
t_8 <- "#22211f"
c_tints <- c(t_1, t_2, t_3, t_4, t_5, t_6, t_7, t_8)
n_tints <- paste0("Tint ", 1:8)
# 2: Secondary Colour Palette (p. 10) ----
#
# Examples
#
# The secondary Cardiff University colour palette will be used
# when deviating from the main site into different subsites and areas.
#
# The rule is open on colour choice but the chosen palette needs to
# contain 3 tints of the same colour, to allow for backgrounds, button overstates etc.
#
# For most websites, the Web & User Experience team will work with you
# to come up with a colour scheme that is both appealing and functional.
#
# Colour is used on the University site for wayfinding as well as to improve contrast
# and visibility of content.
#
# Example colours (dark tint):
col_1 <- grDevices::rgb( 65, 130, 50, maxColorValue = 255)
col_2 <- grDevices::rgb(125, 100, 120, maxColorValue = 255)
col_3 <- grDevices::rgb(175, 55, 105, maxColorValue = 255)
tints_1 <- unikn::shades_of(5, col_1)[3:1]
tints_2 <- unikn::shades_of(5, col_2)[3:1]
tints_3 <- unikn::shades_of(5, col_3)[3:1]
# Color palette(s):
# - cardiff_1: Primary colours of Cardiff University ------
#' Primary colours of Cardiff University, Wales
#'
#' \code{cardiff_1} provides the four primary colours (plus 8 tints)
#' of the \href{https://www.cardiff.ac.uk}{Cardiff University}, Wales, UK.
#'
#' The 4 primary colours are
#' \code{"Cardiff red"}, defined as HEX \code{"#d3374a"} or R:211 G: 55 B: 74,
#' \code{"Cardiff grey"}, defined as HEX \code{"#d3d3d2"} or R:211 G:211 B:210,
#' \code{"Cardiff black}, defined as HEX \code{"#22211f"} or R: 34 G: 33 B: 31, and
#' \code{"white"}, defined as HEX \code{"#ffffff"} or R:255 G:255 B:255.
#'
#' \code{cardiff_1} uses the HEX color definitions.
#'
#' @details
#' Colour is used on the University site for way-finding as well as
#' to improve contrast and visibility of content.
#'
#' The primary \href{https://www.cardiff.ac.uk}{Cardiff University}
#' colour palette should be used consistently throughout its application
#' of the User Experience Style Guidelines.
#'
#' The primary \href{https://www.cardiff.ac.uk}{Cardiff University} colour palette
#' contains a spectrum of 8 tints from light to dark grey.
#' These can be used mainly as graphical backgrounds, button overstates etc.
#'
#' @return
#' A named vector of colors (HEX/HTML codes of type character).
#'
#' @author
#' \strong{unicol}, 2023-09-10.
#'
#' @source
#' Colour definitions are based on \href{https://www.cardiff.ac.uk}{Cardiff University}'s
#' User Experience Style Guide (PDF, v2 of 04/06/2013).
#'
#' @examples
#' cardiff_1
#' unikn::seecol(cardiff_1, col_bg = "grey96",
#' main = "Primary colours of Cardiff University (w/8 tints)")
#'
#' @family Welsh university color palettes
#'
#' @seealso
#' \code{\link{cardiff_2}} for examples of secondary colours of Cardiff University;
#' \code{\link{seecol}} for viewing and comparing color palettes;
#' \code{\link{usecol}} for using color palettes;
#' \code{\link{simcol}} for finding similar colors;
#' \code{\link{newpal}} for defining new color palettes;
#' \code{\link{grepal}} for finding named colors.
#'
#' @export
cardiff_1 <- unikn::newpal(col = c(c_1, c_2, c_3, c_4, c_tints),
names = c("Cardiff red", "Cardiff grey", "Cardiff black", "white", n_tints),
as_df = FALSE)
# # Check:
# unikn::seecol(cardiff_1, main = "Primary colours of Cardiff University (w/8 tints)")
# - cardiff_2: Examples of secondary colours of Cardiff University ------
#' Secondary colour examples of Cardiff University, Wales
#'
#' \code{cardiff_2} provides examples of secondary colours (in 3 tints)
#' of the \href{https://www.cardiff.ac.uk}{Cardiff University}, Wales, UK.
#'
#' The secondary \href{https://www.cardiff.ac.uk}{Cardiff University}
#' colour palette will be used when deviating from the main site
#' into different subsites and areas.
#'
#' @details
#' The rule is open on colour choice but the chosen palette needs to
#' contain 3 tints of the same colour, to allow for backgrounds,
#' button overstates etc.
#'
#' See the \code{\link{shades_of}} or \code{\link{usecol}} functions
#' of \strong{unikn} for creating colour gradients.
#'
#' @return
#' A named vector of colors (HEX/HTML codes of type character).
#'
#' @author
#' \strong{unicol}, 2023-09-10.
#'
#' @source
#' Colour definitions are based on \href{https://www.cardiff.ac.uk}{Cardiff University}'s
#' User Experience Style Guide (PDF, v2 of 04/06/2013).
#'
#' @examples
#' cardiff_2
#' unikn::seecol(cardiff_2, main = "Secondary colours of Cardiff University (3 tints)")
#'
#' @family Welsh university color palettes
#'
#' @seealso
#' \code{\link{cardiff_1}} for primary colours of Cardiff University;
#' \code{\link{seecol}} for viewing and comparing color palettes;
#' \code{\link{usecol}} for using color palettes;
#' \code{\link{simcol}} for finding similar colors;
#' \code{\link{newpal}} for defining new color palettes;
#' \code{\link{grepal}} for finding named colors.
#'
#' @export
cardiff_2 <- unikn::newpal(col = c(tints_1, tints_2, tints_3),
as_df = FALSE)
# # Check:
# unikn::seecol(cardiff_2, main = "Secondary colours of Cardiff University (3 tints)")
## ToDo: --------
# - etc.
## eof. ----------