Skip to content

Commit 0302989

Browse files
authored
Merge pull request #191 from jrnold/hangonasecond-main
[feat] Add aliases for British spelling of colour
2 parents 3ed1490 + 9c8110f commit 0302989

File tree

6 files changed

+44
-10
lines changed

6 files changed

+44
-10
lines changed

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export(canva_pal)
1010
export(circlefill_shape_pal)
1111
export(cleveland_shape_pal)
1212
export(colorblind_pal)
13+
export(colourblind_pal)
1314
export(economist_pal)
1415
export(excel_new_pal)
1516
export(excel_pal)
@@ -46,6 +47,7 @@ export(scale_color_wsj)
4647
export(scale_colour_calc)
4748
export(scale_colour_canva)
4849
export(scale_colour_colorblind)
50+
export(scale_colour_colourblind)
4951
export(scale_colour_economist)
5052
export(scale_colour_excel)
5153
export(scale_colour_excel_new)
@@ -64,6 +66,7 @@ export(scale_colour_wsj)
6466
export(scale_fill_calc)
6567
export(scale_fill_canva)
6668
export(scale_fill_colorblind)
69+
export(scale_fill_colourblind)
6770
export(scale_fill_continuous_tableau)
6871
export(scale_fill_economist)
6972
export(scale_fill_excel)

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# ggthemes (development version)
22

3+
- Renamed `scale_colour_colorblind()` to `scale_colour_colourblind()` (#180).
34
- Updated `theme_solarized` to fix `key.background` color.
5+
- Bugfix: Fix documentation cross-links (#186)
6+
- Bugfix: Removed usage of deprecated ggplot functions
47

58
# ggthemes 5.1.0
69

R/colorblind.R

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,37 @@ colorblind_pal <- function() {
2323

2424
#' @rdname colorblind
2525
#' @export
26-
scale_colour_colorblind <- function(...) {
26+
colourblind_pal <- colorblind_pal
27+
28+
#' @rdname colorblind
29+
#' @export
30+
scale_colour_colourblind <- function(...) {
2731
discrete_scale("colour", palette = colorblind_pal(), ...)
2832
}
2933

3034
#' @rdname colorblind
3135
#' @export
32-
scale_color_colorblind <- scale_colour_colorblind
36+
#' @importFrom lifecycle deprecate_soft
37+
scale_colour_colorblind <- function(...) {
38+
deprecate_soft("5.2.0", "scale_color_colorblind()")
39+
scale_colour_colourblind(...)
40+
}
3341

3442
#' @rdname colorblind
3543
#' @export
44+
scale_color_colorblind <- scale_colour_colourblind
45+
46+
#' @rdname colorblind
47+
#' @description
48+
#' `r lifecycle::badge("deprecated")`
49+
#'
50+
#' @export
51+
#' @importFrom lifecycle deprecate_soft
3652
scale_fill_colorblind <- function(...) {
53+
deprecate_soft("5.2.0", "scale_fill_colorblind()")
3754
discrete_scale("fill", palette = colorblind_pal(), ...)
3855
}
56+
57+
#' @rdname colorblind
58+
#' @export
59+
scale_fill_colourblind <- scale_fill_colorblind

inst/examples/ex-colorblind.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ p <- ggplot(mtcars) +
99
colour = factor(gear)
1010
)) +
1111
facet_wrap(~am)
12-
p + theme_igray() + scale_colour_colorblind()
12+
p + theme_igray() + scale_colour_colourblind()

man/colorblind.Rd

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-colorblind.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ test_that("colorblind_pal raises warning with to large n", {
99
expect_warning(colorblind_pal()(20))
1010
})
1111

12-
test_that("scale_colour_colorblind works", {
13-
expect_s3_class(scale_colour_colorblind(), "ScaleDiscrete")
14-
})
15-
16-
test_that("scale_color_canva works", {
17-
expect_equal_scale(scale_color_colorblind(), scale_colour_colorblind())
12+
test_that("scale_colour_colourblind works", {
13+
expect_s3_class(scale_colour_colourblind(), "ScaleDiscrete")
1814
})
1915

2016
test_that("scale_fill_colorblind works", {

0 commit comments

Comments
 (0)