/ggkeyboard

Make a keyboard using ggplot2.

Primary LanguageROtherNOASSERTION

ggkeyboard

Lifecycle: experimental

ggkeyboard lets you plot a keyboard and change the colours on it. This package is very experimental, so expect breaking changes as I work through making all the customization options as friendly as possible.

You can install ggkeyboard from github:

# install.packages("devtools")
devtools::install_github("sharlagelfand/ggkeyboard", ref = "main")

Usage

Plot a keyboard using ggkeyboard(). The default is very cute:

library(ggkeyboard)

ggkeyboard()

Colour palettes

You can change the colours, font, sizes, etc. There are a few built in colour palettes, available via keyboard_palette():

library(scales)

show_col(keyboard_palette("serika"))

This keyboard is inspired by the Drop + Zambumon MT3 Serika Custom Keycap Set:

ggkeyboard(palette = keyboard_palette("serika"))

This one is inspired by the Melgeek MG Wahtsy ABS Doubleshot Keycap Set:

ggkeyboard(palette = keyboard_palette("wahtsy"))

and this one by the Domikey ABS Doubleshot SA Cyberpunk Pumper Keycap Set:

ggkeyboard(palette = keyboard_palette("cyberpunk"))

Layouts

ggkeyboard() defaults to using a tenkeyless keyboard, available in tkl:

head(tkl)
#> # A tibble: 6 x 8
#>   key       key_label key_type   row number width height layout
#>   <chr>     <chr>     <chr>    <dbl>  <dbl> <dbl>  <dbl> <chr> 
#> 1 Ctrl Left Ctrl      modifier     1      1  1.25      1 60%   
#> 2 Win Left  <NA>      modifier     1      2  1.25      1 60%   
#> 3 Alt Left  Alt       modifier     1      3  1.25      1 60%   
#> 4 Spacebar  <NA>      accent       1      4  6.25      1 60%   
#> 5 Alt Right Alt       modifier     1      5  1.25      1 60%   
#> 6 Win Right <NA>      modifier     1      6  1.25      1 60%

There is also a full keyboard layout available via full. This palette is based off the Varmilo VA108 Fullsize Keyboard

ggkeyboard(full, palette = keyboard_palette("varmilo"), font_size = 2.75)

a 60% layout available via sixty_percent (colour palette based off the Drop + T0mb3ry SA Yuri Custom Keycap Set):

ggkeyboard(sixty_percent, palette = keyboard_palette("t0mb3ry"), adjust_text_colour = FALSE)

and a mac layout, based off the Apple magic keyboard:

ggkeyboard(mac, palette = keyboard_palette("magic"))

You can use an ISO layout by changing layout to “iso”, for any of the given keyboards:

ggkeyboard(tkl, layout = "iso")

Highlighting

You can use highlight_keys() to emphasize any keys - for example, to highlight what keys make up the shortcut for the pipe (%>%):

ggkeyboard(tkl) %>%
  highlight_keys(c("Alt Left", "Shift Left", "M"))