1111# ' legend titles, the plot title and tag text.
1212# ' @param base_line_size base size for line elements
1313# ' @param base_rect_size base size for rect elements
14- # ' @param ink,paper colour for foreground and background elements respectively.
14+ # ' @param ink,paper,accent colour for foreground, background, and accented elements respectively.
1515# '
1616# ' @details
1717# ' \describe{
@@ -108,7 +108,7 @@ theme_grey <- function(base_size = 11, base_family = "",
108108 header_family = NULL ,
109109 base_line_size = base_size / 22 ,
110110 base_rect_size = base_size / 22 ,
111- ink = " black" , paper = " white" ) {
111+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
112112
113113 # The half-line (base-fontsize / 2) sets up the basic vertical
114114 # rhythm of the theme. Most margins will be set to this value.
@@ -157,7 +157,7 @@ theme_grey <- function(base_size = 11, base_family = "",
157157 ),
158158
159159 geom = element_geom(
160- ink = ink , paper = paper , accent = " #3366FF " ,
160+ ink = ink , paper = paper , accent = accent ,
161161 linewidth = base_line_size , borderwidth = base_line_size ,
162162 linetype = 1L , bordertype = 1L ,
163163 family = base_family , fontsize = base_size ,
@@ -288,15 +288,15 @@ theme_bw <- function(base_size = 11, base_family = "",
288288 header_family = NULL ,
289289 base_line_size = base_size / 22 ,
290290 base_rect_size = base_size / 22 ,
291- ink = " black" , paper = " white" ) {
291+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
292292 # Starts with theme_grey and then modify some parts
293293 theme_grey(
294294 base_size = base_size ,
295295 base_family = base_family ,
296296 header_family = header_family ,
297297 base_line_size = base_line_size ,
298298 base_rect_size = base_rect_size ,
299- ink = ink , paper = paper
299+ ink = ink , paper = paper , accent = accent
300300 ) %+ replace %
301301 theme(
302302 # white background and dark border
@@ -321,7 +321,7 @@ theme_linedraw <- function(base_size = 11, base_family = "",
321321 header_family = NULL ,
322322 base_line_size = base_size / 22 ,
323323 base_rect_size = base_size / 22 ,
324- ink = " black" , paper = " white" ) {
324+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
325325 half_line <- base_size / 2
326326
327327 # Starts with theme_bw and then modify some parts
@@ -332,7 +332,7 @@ theme_linedraw <- function(base_size = 11, base_family = "",
332332 header_family = header_family ,
333333 base_line_size = base_line_size ,
334334 base_rect_size = base_rect_size ,
335- ink = ink , paper = paper
335+ ink = ink , paper = paper , accent = accent
336336 ) %+ replace %
337337 theme(
338338 # black text and ticks on the axes
@@ -365,7 +365,7 @@ theme_light <- function(base_size = 11, base_family = "",
365365 header_family = NULL ,
366366 base_line_size = base_size / 22 ,
367367 base_rect_size = base_size / 22 ,
368- ink = " black" , paper = " white" ) {
368+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
369369 half_line <- base_size / 2
370370
371371 # Starts with theme_grey and then modify some parts
@@ -375,7 +375,7 @@ theme_light <- function(base_size = 11, base_family = "",
375375 header_family = header_family ,
376376 base_line_size = base_line_size ,
377377 base_rect_size = base_rect_size ,
378- ink = ink , paper = paper
378+ ink = ink , paper = paper , accent = accent
379379 ) %+ replace %
380380 theme(
381381 # white panel with light grey border
@@ -409,7 +409,7 @@ theme_dark <- function(base_size = 11, base_family = "",
409409 header_family = NULL ,
410410 base_line_size = base_size / 22 ,
411411 base_rect_size = base_size / 22 ,
412- ink = " black" , paper = " white" ) {
412+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
413413 half_line <- base_size / 2
414414
415415 # Starts with theme_grey and then modify some parts
@@ -419,7 +419,7 @@ theme_dark <- function(base_size = 11, base_family = "",
419419 header_family = header_family ,
420420 base_line_size = base_line_size ,
421421 base_rect_size = base_rect_size ,
422- ink = ink , paper = paper
422+ ink = ink , paper = paper , accent = accent
423423 ) %+ replace %
424424 theme(
425425 # dark panel
@@ -451,15 +451,15 @@ theme_minimal <- function(base_size = 11, base_family = "",
451451 header_family = NULL ,
452452 base_line_size = base_size / 22 ,
453453 base_rect_size = base_size / 22 ,
454- ink = " black" , paper = " white" ) {
454+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
455455 # Starts with theme_bw and remove most parts
456456 theme_bw(
457457 base_size = base_size ,
458458 base_family = base_family ,
459459 header_family = header_family ,
460460 base_line_size = base_line_size ,
461461 base_rect_size = base_rect_size ,
462- ink = ink , paper = paper
462+ ink = ink , paper = paper , accent = accent
463463 ) %+ replace %
464464 theme(
465465 axis.ticks = element_blank(), # Extra margins due to absence ticks
@@ -484,14 +484,14 @@ theme_classic <- function(base_size = 11, base_family = "",
484484 header_family = NULL ,
485485 base_line_size = base_size / 22 ,
486486 base_rect_size = base_size / 22 ,
487- ink = " black" , paper = " white" ) {
487+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
488488 theme_bw(
489489 base_size = base_size ,
490490 base_family = base_family ,
491491 header_family = header_family ,
492492 base_line_size = base_line_size ,
493493 base_rect_size = base_rect_size ,
494- ink = ink , paper = paper
494+ ink = ink , paper = paper , accent = accent
495495 ) %+ replace %
496496 theme(
497497 # no background and no grid
@@ -517,7 +517,7 @@ theme_void <- function(base_size = 11, base_family = "",
517517 header_family = NULL ,
518518 base_line_size = base_size / 22 ,
519519 base_rect_size = base_size / 22 ,
520- ink = " black" , paper = alpha(ink , 0 )) {
520+ ink = " black" , paper = alpha(ink , 0 ), accent = " #3366FF " ) {
521521 half_line <- base_size / 2
522522
523523 # Only keep indispensable text: legend and plot titles
@@ -538,6 +538,13 @@ theme_void <- function(base_size = 11, base_family = "",
538538 title = element_text(family = header_family ),
539539 spacing = unit(half_line , " pt" ),
540540 margins = margin_auto(half_line ),
541+ geom = element_geom(
542+ ink = ink , paper = paper , accent = accent ,
543+ linewidth = base_line_size , borderwidth = base_line_size ,
544+ linetype = 1L , bordertype = 1L ,
545+ family = base_family , fontsize = base_size ,
546+ pointsize = (base_size / 11 ) * 1.5 , pointshape = 19
547+ ),
541548 axis.text = element_blank(),
542549 axis.title = element_blank(),
543550 axis.ticks.length = rel(0 ),
@@ -608,7 +615,7 @@ theme_test <- function(base_size = 11, base_family = "",
608615 header_family = NULL ,
609616 base_line_size = base_size / 22 ,
610617 base_rect_size = base_size / 22 ,
611- ink = " black" , paper = " white" ) {
618+ ink = " black" , paper = " white" , accent = " #3366FF " ) {
612619 half_line <- base_size / 2
613620
614621 t <- theme(
@@ -639,7 +646,7 @@ theme_test <- function(base_size = 11, base_family = "",
639646 spacing = unit(half_line , " pt" ),
640647 margins = margin_auto(half_line ),
641648 geom = element_geom(
642- ink = ink , paper = paper , accent = " #3366FF " ,
649+ ink = ink , paper = paper , accent = accent ,
643650 linewidth = base_line_size , borderwidth = base_line_size ,
644651 family = base_family , fontsize = base_size ,
645652 linetype = 1L ,
0 commit comments