@@ -218,6 +218,31 @@ theme_light <- function(base_size = 11, base_family = "") {
218
218
219
219
}
220
220
221
+ # ' @export
222
+ # ' @rdname ggtheme
223
+ theme_dark <- function (base_size = 11 , base_family = " " ) {
224
+ # Starts with theme_grey and then modify some parts
225
+ theme_grey(base_size = base_size , base_family = base_family ) %+ replace %
226
+ theme(
227
+ # dark panel
228
+ panel.background = element_rect(fill = " grey50" , colour = NA ),
229
+ # inverse grid lines contrast compared to theme_grey
230
+ # make them thinner and try to keep the same visual contrast as in theme_light
231
+ panel.grid.major = element_line(colour = " grey42" , size = 0.25 ),
232
+ panel.grid.minor = element_line(colour = " grey42" , size = 0.125 ),
233
+
234
+ # match axes ticks thickness to gridlines
235
+ axis.ticks = element_line(colour = " grey20" , size = 0.25 ),
236
+
237
+ # match legend key to panel.background
238
+ legend.key = element_rect(fill = " grey50" , colour = NA ),
239
+
240
+ # dark strips with light text (inverse contrast compared to theme_grey)
241
+ strip.background = element_rect(fill = " grey15" , colour = NA ),
242
+ strip.text = element_text(colour = " grey90" , size = rel(0.8 ))
243
+ )
244
+ }
245
+
221
246
# ' @export
222
247
# ' @rdname ggtheme
223
248
theme_minimal <- function (base_size = 11 , base_family = " " ) {
@@ -258,31 +283,6 @@ theme_classic <- function(base_size = 11, base_family = ""){
258
283
)
259
284
}
260
285
261
- # ' @export
262
- # ' @rdname ggtheme
263
- theme_dark <- function (base_size = 11 , base_family = " " ) {
264
- # Starts with theme_grey and then modify some parts
265
- theme_grey(base_size = base_size , base_family = base_family ) %+ replace %
266
- theme(
267
- # dark panel
268
- panel.background = element_rect(fill = " grey50" , colour = NA ),
269
- # inverse grid lines contrast compared to theme_grey
270
- # make them thinner and try to keep the same visual contrast as in theme_light
271
- panel.grid.major = element_line(colour = " grey42" , size = 0.25 ),
272
- panel.grid.minor = element_line(colour = " grey42" , size = 0.125 ),
273
-
274
- # match axes ticks thickness to gridlines
275
- axis.ticks = element_line(colour = " grey20" , size = 0.25 ),
276
-
277
- # match legend key to panel.background
278
- legend.key = element_rect(fill = " grey50" , colour = NA ),
279
-
280
- # dark strips with light text (inverse contrast compared to theme_grey)
281
- strip.background = element_rect(fill = " grey15" , colour = NA ),
282
- strip.text = element_text(colour = " grey90" , size = rel(0.8 ))
283
- )
284
- }
285
-
286
286
# ' @export
287
287
# ' @rdname ggtheme
288
288
theme_void <- function (base_size = 11 , base_family = " " ) {
0 commit comments