I Googled it and unfortunately, it's apparently a thing. They're chickens. Not playthings. I didn't read the article thoroughly, so I don't know what kind of mortality there would be from messing with the chicks before they hatch. At the time the article was published, about 1/2 the states did have laws against it.
You can dye them in the egg, yes. This is done by injecting the dye into the shell at a certain stage of development. As you would expect, done wrong it will kill your chicks. And, it's not like they stay that color. All it does is dye their chick down. They'll still feather in normally. The color only lasts about two weeks
Dyeing them is illegal in some states. It's illegal to dye a chicken at any age in Florida, it's also a misdemeanor in California, and it's illegal in Massachusetts too. On top of that, while it's legal to dye them in a lot of states, selling dyed chicks is illegal in about half the states.