Problem 42612. Convert ColorSpec string to RGB triplet

Created by Matthew Eicholtz in Community

Given a ColorSpec string, either in short or long form, return the corresponding RGB triplet. If the input is not a valid color, return an empty vector.


str2rgb('red') returns [1 0 0]
str2rgb('k') returns [0 0 0]
str2rgb('pizza') returns []

Solution Stats

76.19% Correct | 23.81% Incorrect
Last solution submitted on Mar 20, 2019

Problem Comments