Icons that are uploaded typically use an <img>
tag to be displayed… that includes complex SVGs with color as well as all other image types like PNG, JPEG, etc.
If you upload a ‘simple’ SVG file with no fill properties set (eg. a single color), it gets embedded inline using an <svg>
tag and it can inherit theme colors as noted in the Custom Icons FAQ: