Color structure of Yang-Mills theory with static sources in a periodic box