This is easily done, you can create an index for each color or color range.
Additionally, you can mess with the typical B&W conversion weights for each channel.
However this got me thinking, what do we want when we convert an image to bw? It's a pretty hard problem, because we want both semantic segmentation and preserving lightness.
Also you clearly can't have a one-to-one mapping when you lose 2 dimensions. Of course in the case of a simple UI that's not a problem, but with photography it is.
Additionally, you can mess with the typical B&W conversion weights for each channel.
However this got me thinking, what do we want when we convert an image to bw? It's a pretty hard problem, because we want both semantic segmentation and preserving lightness. Also you clearly can't have a one-to-one mapping when you lose 2 dimensions. Of course in the case of a simple UI that's not a problem, but with photography it is.