So there are a bunch of different places that color gets specified, and they're not exactly consistent. The
wiki does a reasonable job of explaining how all of them work.
For gems and hardcoded materials, the STATE_COLOR is generally compatible with the DISPLAY_COLOR and so on (except for liquid water which is displayed blue but colored "clear"). For bodyparts and bodily fluids, the STATE_COLOR is the
only color defined.
Non-gem stones don't define STATE_COLORs at all, relying on the stone template which defines the solid STATE_COLOR as GRAY. This means a Dwarf with Gray as a favorite color is probably going to be perpetually happy, but it also means that the DISPLAY_COLOR, BUILD_COLOR, etc. are inconsistent with the STATE_COLOR.
It'd be possible to just display things in their STATE_COLOR and everything would work as expected. Except for stone. Which shows up fairly often in a typical DF game.
My suggestion would be to scope local display colors within materials, basically assigning the STATE_COLOR's rgb values to the closest display color. For example, an AUBURN material would set the closest display color (4:0 which is "red") to 111:53:26 and use that anywhere that red was called for. This conveniently side-steps the GRAY issue for stones if the display colors conflict with the STATE_COLOR, since that display color just doesn't get used anywhere.
There are a couple cases that need some thought. For example, one modder might display an AZURE material (0:127:255) as light blue and another as cyan and yet another as light cyan. The plugin would customize one of those display colors and leave the other two as defaults. Personally, I'd rather live with near-misses like that than try to code in a bunch of exception handling to second-guess the modders.