Learn R Programming

blockr.dock (version 0.1.0)

blks_metadata: Get block metadata

Description

Returns various metadata for blocks or block categories, as well as styling for block icons.

Usage

blks_metadata(blocks)

blk_color(category)

blk_icon_data_uri(icon_svg, color, size = 48, mode = c("uri", "inline"))

Value

Metadata is returned from blks_metadata() as a data.frame with each row corresponding to a block. Both blk_color() and blk_icon_data_uri() return character vectors.

Arguments

blocks

Blocks passed as blocks or block object

category

Block category

icon_svg

Character string containing the SVG icon markup

color

Hex color code for the background

size

Numeric size in pixels (default: 48)

mode

Switch between URI and inline HTML mode

Details

  • blks_metadata(): Retrieves metadata given a block or blocks object from the block registry. Can also handle blocks which are not registered and provides default values in that case.

  • blk_color(): Produces colors using the Okabe-Ito colorblind-friendly palette for a character vector of block categories.

  • blk_icon_data_uri(): Processes block icons to add color and turn them into square-shaped icons.

Examples

Run this code
blk <- blockr.core::new_dataset_block()
meta <- blks_metadata(blk)

col <- blk_color(meta$category)
blk_icon_data_uri(meta$icon, col)

Run the code above in your browser using DataLab