add_colored_str: Add a string with specified color or background color.

View source: R/helper_html.R

add_colored_strR Documentation

Add a string with specified color or background color.

Description

add_colored_str returns a string component generated by htmltools with specified color and styles.

Usage

add_colored_str(
  text = "",
  color = c(51, 122, 183),
  alpha = 255,
  bgcolor = NULL,
  bgalpha = 51,
  fontsize = 1,
  bold = FALSE,
  it = FALSE
)

Arguments

text

A string. default="".

color

One of

  • a color name, e.g. 'red'.

  • a HEX color string, e.g. '#000000' or '#000000FF'.

  • an RGB vector for the color of text

alpha

An integer between 1 and 255 for text alpha. default=255.

bgcolor

One of

  • a color name, e.g. 'red'.

  • a HEX color string, e.g. '#000000' or '#000000FF'.

  • an RGB vector for the color of text

bgalpha

An integer between 1 and 255 for background alpha. default=51.

fontsize

A real number between 0.5 and 5.0 for font size. default=1.

bold

A logical value for bold fonts. default=FALSE.

it

A Boolean value for italic fonts. default=FALSE.

Value

a formatted string

Examples

add_colored_str("warning: read this message carefully.", color = c(255, 0, 0))


mtb documentation built on Oct. 21, 2022, 1:05 a.m.