I have a shapefile layer with R,G,B fields and used the following expression to set the symbol color.

Surprisingly, it worked right away. However, even though the colors are applied in the canvas, they are not reflected in the legend. If I select categories instead of single symbol,the result is the same: the symbol colors doesn't match. I would like to know if there's some efficient way to to get the correct colors for the legend symbols.
Here's a video that shows the process: https://streamable.com/2l35dc
