Render preview of a color in a file

It would be very useful to implement a preview of a color that is defined in a .md file, similar to how it is done in VS Code in a .css file. This would allow us to store our favourite colors for future use and to quickly identify what they look like.

For example, if #34AB34 is typed, the matching color is displayed as a square before or after the hex code. Other color formats could also be supported.
Optionally, the color code could also be ==highlighted== in that color to preview it.

You’d have to look these up manually, but you could make a note with a list of items like

<span style="color: #34AB34;">■</span>

or

<span style="background-color: #34AB34;">#34AB34</span>.