adjust_hsv: Adjust a color's HSV components

Description Usage Arguments Value See Also Examples

Description

These functions adjust a color's hue, saturation, and brightness (value).

adjust_hsv adjusts hue, saturation, and brightness either by replacing the current value (mode="absolute") or adding to it (mode="relative", the default).

saturate and desaturate increase and decrease saturation by the given amount, respectively

greyscale (or grayscale) fully desaturates the color

brighten and darken increase and decrease brightness by the given amount, respectively

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
adjust_hsv(col, h = NULL, s = NULL, v = NULL, mode = "relative")

saturate(col, amount)

desaturate(col, amount)

greyscale(col, amount)

brighten(col, amount)

darken(col, amount)

Arguments

col

Vector containing any of the three kinds of R color specifications:

  1. a color name (see colors)

  2. a hexadecimal string of the form "#rrggbb" (see rgb)

  3. a positive integer i meaning palette()[i]

h

The adjustment in hue [-1,1] (default: no adjustment)

s

The adjustment in saturation [-1,1] (default: no adjustment)

v

The adjustment in brightness [-1,1] (default: no adjustment)

mode

Whether the adjustments set the value directly ("absolute") or are added to the current value ("relative", default).

amount

The value of the adjustment

Value

The adjusted color(s) as hexadecimal strings

See Also

hue, saturation, brightness to these component values

Examples

1
2
# Decrease saturation of orange by 0.1
adjust_hsv(col = "orange", s = -0.1)

briandconnelly/colormod documentation built on May 13, 2019, 5:13 a.m.