bm_replace | R Documentation |
bm_replace()
replaces a bitmap color with another color.
In particular default arguments will try to replace the background color.
bm_replace(x, value, old)
## S3 method for class 'bm_bitmap'
bm_replace(x, value = 0L, old = x[1L, 1L])
## S3 method for class 'bm_list'
bm_replace(x, ...)
## S3 method for class 'bm_pixmap'
bm_replace(x, value = col2hex("transparent"), old = x[1L, 1L])
## S3 method for class ''magick-image''
bm_replace(x, value = "transparent", old = as.raster(x)[1L, 1L])
## S3 method for class 'nativeRaster'
bm_replace(x, value = col2int("transparent"), old = x[1L, 1L])
## S3 method for class 'raster'
bm_replace(x, value = "transparent", old = x[1L, 1L])
x |
Either a |
value |
New bitmap “color” value. |
old |
Old bitmap “color” value to replace. |
... |
Additional arguments to be passed to or from methods. |
Depending on x
either a bm_bitmap()
, bm_font()
, bm_list()
, magick-image, "nativeRaster", bm_pixmap()
, or raster object.
corn <- farming_crops_16x16()$corn$portrait
if (cli::is_utf8_output() && cli::num_ansi_colors() >= 256L) {
print(bm_replace(corn, "cyan"), compress = "v")
}
font_file <- system.file("fonts/spleen/spleen-8x16.hex.gz", package = "bittermelon")
font <- read_hex(font_file)
capital_r <- font[[str2ucp("R")]]
print(bm_replace(capital_r, 2L))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.