How do you apply colors to bones and shapes

The question is pretty much what the title says. How do I assign different colors to bones, and more importantly assign colors to custom bone shapes?

Bone shapes use the bone color automatically- you can assign colors by adding bones to bone groups:

https://docs.blender.org/manual/en/latest/animation/armatures/properties/bone_groups.html