I used the /give command to get a shield with damage on it,
I got a shield labeled "Black Shield", but the color of the shield was blue. When I went to repair the shield on an anvil, everytime i placed a wood plank, it would change colors until it reached full durability. The name still remains as "Black Shield". Now, after I repaired the shield, I tested its damage and found out that it also caused the shield to turn colors as its durability changed and decreased just like how it did when repairing.
/give JarethG100 minecraft:shield 1 179
There are two gifs below: Part 1 is when repairing the shield, and Part 2 is when the shield takes damage.