class_color: color class

class_colorR Documentation

color class

Description

Useful for manipulating colors in R.

Usage

class_color(
  color = character(0),
  hue = NULL,
  saturation = NULL,
  brightness = NULL,
  alpha = NULL,
  id = character(0)
)

Arguments

color

character (R color or hex code)

hue

get or set the hue of a color (i.e., the h in the hsv model)

saturation

get or set the saturation of a color (i.e., the s in the hsv model)

brightness

get or set the brightness of a color (i.e., the v in the hsv model)

alpha

get or set the transparency of a color

id

character identifier

Value

class_color object

Slots

transparentize

function to return the color with a new transparency (i.e., alpha)

lighten

function to return a lighter color

darken

function to return a darker color

Examples

mycolor <- class_color("blue")
mycolor
# Display html hexcode
c(mycolor)
# Set transparency
mycolor@transparentize(.5)
# Lighten color
mycolor@lighten(.5)
# Darken color
mycolor@darken(.5)

ggdiagram documentation built on Sept. 15, 2025, 1:07 a.m.