A long black hatpin. Stick it in any hat and you will know, for a moment, what colour you are wearing.
Mother Gormla Thewless, Who Hangs Hats on the Dead in The Outer Fields (CR 14). The power is dispatched by the item tag through bele_artpow_inc; the wrapper script is tofc1_gor_art.