We derive a formula for the chromatic polynomial of a chordal or a triangulated graph in terms of its maximal cliques. As a corollary we obtain a way to write down an explicit formula for the chromatic polynomial for an arbitrary power of a graph which belongs to any given class of chordal graphs that are closed under taking powers.