Solution 1: Do not use a font
You have not talked much about what you are actually doing. Creating a website? Web interface for the client to edit the icon in the website content management system? I suppose.
You seem to be too complicated thinking about fonts in general. They are usually monochromatic animals. Usually.
Why not just use SVG? You can easily create or load it in Javascript and edit it from Javascript; There are many online demos, and I have provided one more here. Changing two colors would be pretty trivial.
Here is a quick way to create an SVG on a page and even suggest it to be downloaded as a separate file:
<!DOCTYPE html> <html><head> <title>Chess SVG Builder</title> <script type="text/javascript"> window.addEventListener("load", function() { </script> </head><body> <svg width="550" height="550"> </svg><br /> <a>Download as a file</a> </body></html>
As you can see, I really have an interest in creating colorful fonts. I want my chess pieces to retain their semantic meaning for the computer, and therefore I have been writing them with Unicode characters since 9812. And if your screen font is similar to mine, you will see monochromatic fragments with spaces in them; it is a crude attempt to imitate a second color; red squares interfere with the pieces, and the chess position will be unreadable.
On its own display, the โwhiteโ shapes on the red squares do not actually have white spots inside them; so I don't think I'm nitpicking here ... I think it's fair to ask that the white king should be white.
Solution 2: Using the Font
Still use SVG to define the font, but much more manual reading will be involved.
Do SVG fonts allow multiple colors in a single character? Iโm not sure of the correctness of inheritance rules, and this seems relevant to you. Read and experiment?
w3c glyph specification
If I understood what I was reading, changing the length values โโfrom css can be confusing because the glyph is defined as you need, it would actually use the local glyph coordinate system (?) But the colors should be safe.
I may have some code samples later, whenever I myself am on it. I think this may affect the change of SVG from Javascript; I canโt imagine that CSS can control all the colors of such a custom font. It seems to me that "inherit" is a property to use for the default color, while other colors used in the glyph need JS? Maybe later when I know.