Avoid error in rgb() function if variables are used (#12752).

Change-Id: Id51ffef257c193900026a4644eb99dbd3926c668