  Cographs are exactly the hereditarily well-colored graphs, i.e., the graphs
for which a greedy vertex coloring of every induced subgraph uses only the
minimally necessary number of colors $\chi(G)$. We show that greedy colorings
are a special case of the more general hierarchical vertex colorings, which
recently were introduced in phylogenetic combinatorics. Replacing cotrees by
modular decomposition trees generalizes the concept of hierarchical colorings
to arbitrary graphs. We show that every graph has a modularly-minimal coloring
$\sigma$ satisfying $|\sigma(M)|=\chi(M)$ for every strong module $M$ of $G$.
This, in particular, shows that modularly-minimal colorings provide a useful
device to design efficient coloring algorithms for certain hereditary graph
classes. For cographs, the hierarchical colorings coincide with the
modularly-minimal coloring. As a by-product, we obtain a simple linear-time
algorithm to compute a modularly-minimal coloring of $P_4$-sparse graphs.
