Learn R Programming

R.AlphA.Home (version 2.0.2)

ret_lum: 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)

Value

A modified hex color in hexadecimal format.

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.

Examples

Run this code
# 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

Run the code above in your browser using DataLab