Skip to content

Commit

Permalink
re-factor utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestguevarra committed Feb 29, 2024
1 parent ad9bf5c commit 67cfbc0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ cmyk2rgb <- function(C, M, Y, K) {
#'
print.palette <- function(x, ...) {
n <- length(x)
# old <- par(mar = c(0.5, 0.5, 0.5, 0.5))
# on.exit(par(old))
old <- par(mar = c(0.5, 0.5, 0.5, 0.5))
on.exit(par(old))

Check warning on line 47 in R/utils.R

View check run for this annotation

Codecov / codecov/patch

R/utils.R#L46-L47

Added lines #L46 - L47 were not covered by tests

image(1:n, 1, as.matrix(1:n), col = x,
ylab = "", xaxt = "n", yaxt = "n", bty = "n")
Expand Down
10 changes: 5 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ oxford_colours |>
knitr::kable()
```

```{r oxford-colours-graphic, echo = FALSE, fig.height = 1}
```{r oxford-colours-graphic, echo = FALSE, fig.height = 1, fig.align = "center"}
structure(get_oxford_colours() |> (\(x) x[x != ""])(), class = "palette", name = "Oxford Colours")
```

Expand All @@ -87,7 +87,7 @@ Based on the [University of Oxford](https://ox.ac.uk)'s [visual identity guideli
oxford_theme_palettes()$heritage
```

```{r oxford-palettes-heritage-show, echo = FALSE, fig.height = 1}
```{r oxford-palettes-heritage-show, echo = FALSE, fig.height = 1, fig.align = "center"}
structure(oxford_theme_palettes()$heritage, class = "palette", name = "heritage")
```

Expand All @@ -97,7 +97,7 @@ structure(oxford_theme_palettes()$heritage, class = "palette", name = "heritage"
oxford_theme_palettes()$contemporary
```

```{r oxford-palettes-contemporary-show, echo = FALSE, fig.height = 1}
```{r oxford-palettes-contemporary-show, echo = FALSE, fig.height = 1, fig.align = "center"}
structure(oxford_theme_palettes()$contemporary, class = "palette", name = "contemporary")
```

Expand All @@ -107,7 +107,7 @@ structure(oxford_theme_palettes()$contemporary, class = "palette", name = "conte
oxford_theme_palettes()$celebratory
```

```{r oxford-palettes-celebratory-show, echo = FALSE, fig.height = 1}
```{r oxford-palettes-celebratory-show, echo = FALSE, fig.height = 1, fig.align = "center"}
structure(oxford_theme_palettes()$celebratory, class = "palette", name = "celebratory")
```

Expand All @@ -117,7 +117,7 @@ structure(oxford_theme_palettes()$celebratory, class = "palette", name = "celebr
oxford_theme_palettes()$corporate
```

```{r oxford-palettes-corporate-show, echo = FALSE, fig.height = 1}
```{r oxford-palettes-corporate-show, echo = FALSE, fig.height = 1, fig.align = "center"}
structure(oxford_theme_palettes()$corporate, class = "palette", name = "corporate")
```

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ the following colours are available from this package:
| Gold | | | | 10122C |
| Silver | | | | 10103C |

![](man/figures/README-oxford-colours-graphic-1.png)<!-- -->
<img src="man/figures/README-oxford-colours-graphic-1.png" style="display: block; margin: auto;" />

You can access either the name, RGB, CMYK, hex code, and/or Pantone
values of each Oxford colour through the `get_oxford_colours()` function
Expand Down Expand Up @@ -136,7 +136,7 @@ oxford_theme_palettes()$heritage
#> [1] "#994636" "#E08D79" "#C4A29E" "#A0AF84" "#426A5A"
```

![](man/figures/README-oxford-palettes-heritage-show-1.png)<!-- -->
<img src="man/figures/README-oxford-palettes-heritage-show-1.png" style="display: block; margin: auto;" />

#### Contemporary

Expand All @@ -145,7 +145,7 @@ oxford_theme_palettes()$contemporary
#> [1] "#FE615A" "#ED9390" "#E4F0EF" "#789E9E" "#00AAB4"
```

![](man/figures/README-oxford-palettes-contemporary-show-1.png)<!-- -->
<img src="man/figures/README-oxford-palettes-contemporary-show-1.png" style="display: block; margin: auto;" />

#### Celebratory

Expand All @@ -154,7 +154,7 @@ oxford_theme_palettes()$celebratory
#> [1] "#15616D" "#776885" "#E2C044" "#D4CDF4" "#7F055F"
```

![](man/figures/README-oxford-palettes-celebratory-show-1.png)<!-- -->
<img src="man/figures/README-oxford-palettes-celebratory-show-1.png" style="display: block; margin: auto;" />

#### Corporate

Expand All @@ -163,7 +163,7 @@ oxford_theme_palettes()$corporate
#> [1] "#FB5607" "#B9D6F2" "#95C11F" "#49B6FF" "#1D42A6"
```

![](man/figures/README-oxford-palettes-corporate-show-1.png)<!-- -->
<img src="man/figures/README-oxford-palettes-corporate-show-1.png" style="display: block; margin: auto;" />

### Oxford theme paletttes for use in plotting

Expand Down

0 comments on commit 67cfbc0

Please sign in to comment.