In case you really are restricted to only using images, here is a function that creates a 1x1 pixel GIF of the color you specify. Then that can be scaled to the size you want (note effect of fit):
#let img-bytes(col) = {
//Get values for R, G, B (surely there's a cleaner way of getting these)
let r = int((rgb(col).components().at(0) / 100%) * 0xFF)
let g = int((rgb(col).components().at(1) / 100%) * 0xFF)
let b = int((rgb(col).components().at(2) / 100%) * 0xFF)
//Create the GIF byte array
let img = (0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x01, 0x00, r, g, b, 0xFF, 0xFF, 0xFF, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3B)
//Return the "image" as bytes type
return bytes(img)
}
#image(img-bytes(red), format: "gif", width: 3cm, fit: "cover")