OP here. "How it happens" is not "why it happens". The svg renderer is switching the values of R and B, that's why it turns blue instead of some other color. Why the renderer does that, I have no idea :)
Sorry, I would check myself, but am on Linux and don't have access to Safari 10.