How is color identity determined for double faced cards?

Context: I'm a dev that has only recently learned of xMage and I'm trying to learn my way around the code.
Can a knowledgable dev point me in the right direction? I'm trying to figure out where in the code the color identity is determined for a double sided card. For example, if a card is white on the day side and red on the night side, the color identity should be
but I can't figure out where that logic is.
I'm assuming there a centralized point in the code that color identity is determined based on the various rules (mana symbols in rules text, etc.)?
Can a knowledgable dev point me in the right direction? I'm trying to figure out where in the code the color identity is determined for a double sided card. For example, if a card is white on the day side and red on the night side, the color identity should be


I'm assuming there a centralized point in the code that color identity is determined based on the various rules (mana symbols in rules text, etc.)?