Skip to contents

methods for colors

Super class

charlatan::BaseProvider -> ColorProvider

Public fields

locale

(character) xxx

all_colors

(character) xxx

safe_colors

(character) xxx

Methods

Inherited methods


Method allowed_locales()

fetch the allowed locales for this provider

Usage

ColorProvider$allowed_locales()


Method new()

Create a new ColorProvider object

Usage

ColorProvider$new(locale = NULL)

Arguments

locale

(character) the locale to use. See $allowed_locales() for locales supported (default: en_US)

Returns

A new ColorProvider object


Method color_name()

color name

Usage

ColorProvider$color_name()


Method safe_color_name()

safe color name

Usage

ColorProvider$safe_color_name()


Method hex_color()

hex color

Usage

ColorProvider$hex_color()


Method safe_hex_color()

safe hex color

Usage

ColorProvider$safe_hex_color()


Method rgb_color()

RGB color

Usage

ColorProvider$rgb_color()


Method rgb_css_color()

RGB CSS color

Usage

ColorProvider$rgb_css_color()


Method clone()

The objects of this class are cloneable with this method.

Usage

ColorProvider$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

x <- ColorProvider$new()
x$locale
#> [1] "en_US"
x$color_name()
#> [1] "HoneyDew"
x$safe_color_name()
#> [1] "black"
x$hex_color()
#> [1] "#7A3862"
x$safe_hex_color()
#> [1] "#00ccff"
x$rgb_color()
#> [1]  28  88 210
x$rgb_css_color()
#> [1] "rgb(123, 255, 247)"

x <- ColorProvider$new(locale = "uk_UA")
x$locale
#> [1] "uk_UA"
x$color_name()
#> [1] "Зелений"
x$safe_color_name()
#> [1] "Оливковий"