Learn R Programming

TransProR (version 1.0.2)

adjust_color_tone: Adjust Color Tone by Modifying Saturation and Luminance

Description

This function adjusts the saturation and luminance of a given color. It works by converting the color from RGB to Luv color space, applying the scaling factors to the saturation and luminance, and then converting it back to RGB.

Usage

adjust_color_tone(color, saturation_scale, luminance_scale)

Value

Returns a color in hexadecimal format adjusted according to the provided scales.

Arguments

color

A color in hexadecimal format (e.g., "#FF0000") or a valid R color name.

saturation_scale

Numeric, the scaling factor for saturation (values < 1 decrease saturation, values > 1 increase saturation).

luminance_scale

Numeric, the scaling factor for luminance (values < 1 darken the color, values > 1 lighten the color).

Examples

Run this code
  adjusted_color <- adjust_color_tone("#FF0000", saturation_scale = 0.8, luminance_scale = 1.2)
  print(adjusted_color)

Run the code above in your browser using DataLab