Type: | Package |
Title: | Give Colors a Name |
Version: | 0.1.0 |
Description: | A tool for transforming coordinates in a color space to common color names using data from the Royal Horticultural Society and the International Union for the Protection of New Varieties of Plants. |
License: | MIT + file LICENSE |
URL: | https://github.com/msanchez-beeckman/ColorNameR |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 2.10) |
Imports: | magrittr, dplyr, rlang, purrr, grDevices |
RoxygenNote: | 7.1.1 |
Suggests: | tibble, testthat (≥ 3.0.0), ggplot2, RColorBrewer |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2021-07-07 14:38:19 UTC; marco |
Author: | Marco Sánchez Beeckman [aut, cre] |
Maintainer: | Marco Sánchez Beeckman <msanchezb3@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2021-07-08 07:40:05 UTC |
Get the CIE76 color difference between two CIELab values.
Description
Get the CIE76 color difference between two CIELab values.
Usage
cie76(lab_color1, lab_color2)
Arguments
lab_color1 |
A vector with three components corresponding to a Lab value. |
lab_color2 |
A vector with three components corresponding to another Lab value. |
Value
The CIE76 color difference between the two given values.
References
Sharma, G., & Bala, R. (Eds.). (2017). Digital color imaging handbook. CRC press.
Get the CIE94 color difference between two CIELab values.
Description
Get the CIE94 color difference between two CIELab values.
Usage
cie94(
lab_color1,
lab_color2,
k_L = 1,
k_C = 1,
k_H = 1,
K1 = 0.045,
K2 = 0.015,
symmetric = FALSE
)
Arguments
lab_color1 |
A vector with three components corresponding to a Lab value. |
lab_color2 |
A vector with three components corresponding to another Lab value. |
k_L |
Weighting factor for the L component. |
k_C |
Weighting factor for the C component. |
k_H |
Weighting factor for the H component. |
K1 |
Application dependent weighting factor. |
K2 |
Application dependent weighting factor. |
symmetric |
If TRUE, use the symmetric version of the formula. |
Value
The CIE94 color difference between the two given values.
References
Sharma, G., & Bala, R. (Eds.). (2017). Digital color imaging handbook. CRC press.
Get the CIEDE2000 color difference between two CIELab values.
Description
Get the CIEDE2000 color difference between two CIELab values.
Usage
ciede2000(lab_color1, lab_color2, k_L = 1, k_C = 1, k_H = 1)
Arguments
lab_color1 |
A vector with three components corresponding to a Lab value. |
lab_color2 |
A vector with three components corresponding to another Lab value. |
k_L |
Weighting factor for the L component. |
k_C |
Weighting factor for the C component. |
k_H |
Weighting factor for the H component. |
Value
The CIEDE2000 color difference between the two given values.
References
Sharma, G., Wu, W., & Dalal, E. N. (2005). The CIEDE2000 color-difference formula: Implementation notes, supplementary test data, and mathematical observations. Color Research & Application: Endorsed by Inter-Society Color Council, The Colour Group (Great Britain), Canadian Society for Color, Color Science Association of Japan, Dutch Society for the Study of Color, The Swedish Colour Centre Foundation, Colour Society of Australia, Centre Français de la Couleur, 30(1), 21-30.
Get the color difference between values in the CIELab color space.
Description
Get the color difference between values in the CIELab color space.
Usage
colordiff(color, reference, metric = "CIEDE2000", ...)
Arguments
color |
A matrix whose rows specify color coordinates in the CIELab color space. |
reference |
A reference color. |
metric |
The color metric, between CIE76, CIE94, and CIEDE2000. |
... |
Weighting factors |
Value
The color difference between the two given values.
References
Sharma, G., & Bala, R. (Eds.). (2017). Digital color imaging handbook. CRC press. Sharma, G., Wu, W., & Dalal, E. N. (2005). The CIEDE2000 color-difference formula: Implementation notes, supplementary test data, and mathematical observations. Color Research & Application: Endorsed by Inter-Society Color Council, The Colour Group (Great Britain), Canadian Society for Color, Color Science Association of Japan, Dutch Society for the Study of Color, The Swedish Colour Centre Foundation, Colour Society of Australia, Centre Français de la Couleur, 30(1), 21-30.
Examples
colordiff(rbind(c(50, 2.6772, -79.7751),
c(50, 3.1571, -77.2803),
c(50, 2.8361, -74.0200)), c(50, 0, -82.7485))
colordiff(rbind(c(50, 2.6772, -79.7751),
c(50, 3.1571, -77.2803),
c(50, 2.8361, -74.0200)), c(50, 0, -82.7485), metric="CIE94")
colordiff(rbind(c(50, 2.6772, -79.7751),
c(50, 3.1571, -77.2803),
c(50, 2.8361, -74.0200)), c(50, 0, -82.7485), metric="CIE94", symmetric=TRUE)
Get information about the closest RHS color to some CIELab coordinates.
Description
Get information about the closest RHS color to some CIELab coordinates.
Usage
get_closest_color(L, a, b, metric = "CIEDE2000")
Arguments
L |
The lightness L* of the color. |
a |
The chromatic component a* (red-green). |
b |
The chromatic component b* (blue-yellow). |
metric |
The color distance to use. |
Value
A one-row tibble.
Examples
get_closest_color(65, 20, -20)
Name a color given its coordinates in a specified color space.
Description
Name a color given its coordinates in a specified color space.
Usage
name(color, colorspace = "Lab", illuminant = NULL, language = "english")
Arguments
color |
A matrix whose rows specify colors. |
colorspace |
The color space the coordinates of the colors are in. |
illuminant |
The reference white, or |
language |
The language of the color name, between English, French, German, and Spanish. |
Details
The available color spaces are "XYZ"
, "sRGB"
, "Apple RGB"
, "CIE RGB"
, "Luv"
, and "Lab"
(default).
If the color space is an RGB variant, the coordinates must take values between 0 and 1.
Value
The name of the color, according to the UPOV.
Examples
name(c(65, 20, -20))
name(c(65, 20, -20), language="Spanish")
name(c(65, 20, -20), language="es")
name(c(244/255, 234/255, 184/255), colorspace="sRGB")
name(rbind(c(65, 20, -20), c(69, 4, -31)))
UPOV names and groups for RHS colors.
Description
Data set containing English, French, German, and Spanish names for the colors defined by the RHS in its sixth edition (2015), alongside their UPOV group number.
Usage
rhs_color_names_2015
Format
A data frame with 920 rows and 10 variables:
- UPOVGroup
the UPOV group of the color
- RHS
the RHS code of the color
- english
the English name for the color
- french
the French name for the color
- german
the German name for the color
- spanish
the Spanish name for the color
Source
UPOV https://www.upov.int/meetings/en/doc_details.jsp?meeting_id=50790&doc_id=426293
RHS colors in different color spaces.
Description
Data set containing the coordinates in RGB, CIELab, and CIELCh of the colors defined by the Royal Horticultural Society in its fifth edition (2007).
Usage
rhs_color_values_2007
Format
A data frame with 892 rows and 10 variables:
- RHS
the RHS code of the color
- R
the red component in sRGB
- G
the green component in sRGB
- B
the blue component in sRGB
- L
the lightness component in CIELab (D65 / 10º)
- a
the red-green component in CIELab (D65 / 10º)
- b
the blue-yellow component in CIELab (D65 / 10º)
- L2
the lightness component in CIELCh (D65 / 10º)
- C
the colorfulness component in CIELCh (D65 / 10º)
- h
the hue in CIELCh (D65 / 10º)