that would require the source data to be BGR, i.e. 3-channel.
if you don’t have 3-channel data, you shouldn’t expect that color conversion code to work.
if you have 1-channel data instead, use a different color conversion code… perhaps one that reads like “gray to …”