ret_lum: Adjust the Brightness of a Hex Color

View source: R/ret_lum.R

ret_lumR Documentation

Adjust the Brightness of a Hex Color

Description

Modifies the brightness of a color by multiplying its RGB components by a specified factor.

Mostly for internal usage inside lum_0_100 function.

Usage

ret_lum(hexCol, rgbFact)

Arguments

hexCol

Character. The color to adjust, specified in hexadecimal format (e.g., "#FF5733").

rgbFact

Numeric. The luminosity factor : - use a factor between 0 and 1 to decrease luminosity - use a factor >1 to increase it The final Brightness value will be maintained between 0 and 1.

Value

A modified hex color in hexadecimal format.

Examples

# Example 1: Lightening a color
ret_lum("#FF5733", 1.5)  # Returns a lighter version of the input color

# Example 2: Darkening a color
ret_lum("#FF5733", 0.7)  # Returns a darker version of the input color


R.AlphA.Home documentation built on April 3, 2025, 5:53 p.m.