adjust_hsv: Adjust Color in HSV Space

View source: R/adjust_hsv.R

adjust_hsvR Documentation

Adjust Color in HSV Space

Description

Adjust hue, saturation, value, and/or opacity.

Usage

adjust_hsv(col, h=NULL, s=NULL, v=NULL, alpha=NULL)

Arguments

col

a color or vector of colors.

h

the desired hue.

s

the desired saturation.

v

the desired value.

alpha

the desired opacity.

Details

Colors can be specified as a color name, a hexadecimal string, or an integer.

Hue, saturation, value, and opacity are specified as values from 0 to 1, or NULL to leave unchanged.

Value

Adjusted colors in hexadecimal string format.

Author(s)

Arni Magnusson.

See Also

adjustcolor adjusts colors in RGB space.

col2rgb, rgb2hsv, and hsv are the underlying functions used to convert and adjust the colors.

Examples

col <- "#123456"
col2 <- adjust_hsv(col, h=0.1)
col3 <- adjust_hsv(col, s=0.1)
col4 <- adjust_hsv(col, v=0.7)

barplot(rep(1, 4), col=c(col, col2, col3, col4),
        names=c("original", "h", "s", "v"))

talgalili/gplots documentation built on June 12, 2025, 1:40 a.m.