solid color to sprite (javascript game)

Hi I recently created a javascript game, in this game, math random is used to pick a random shape.

The shapes are in strings, and the associated numbers within the string are then used to show a color.

Is there any way to replace the simple hex colors with an image?

For example:

else if (shape === "H"){
    return ((8,8,8),
            (8,8,8),
            (8,8,8));

The “8” ties into the following string to get the #F10B38 color.

const color = (null,"#FF2D00","#FF9300","#51FF00","#00FF93","#0087FF","#4E49A7","#9649A7","#F10B38");