rgb2hex
Description
converts the specified RGB triplets to strings containing six-digit hexadecimal color codes.
To convert m RGB triplets, specify hexStr
= rgb2hex(RGB
)RGB
as an
m-by-3 matrix. To convert an
m-by-n image, specify RGB
as an
m-by-n-by-3 array. Each value returned in
hexStr
starts with a hash symbol (#
) followed by six
hexadecimal digits.
specifies whether to return the hexadecimal color codes in shorthand notation. By default,
the output contains the six-digit codes. Shorthand values contain only three hexadecimal
digits (one digit for each color component). As a consequence, these values can be less
accurate than the six-digit notation.hexStr
= rgb2hex(RGB
,Shorthand=tf
)
Examples
Input Arguments
Output Arguments
Version History
Introduced in R2024a