# Is it possible to add colored text (spaces, or colored boxes) to a headrule?

I intend to use small colored boxes in front of sections in order to identify at which heading level the text is located, and I'd want my reader to quickly reference the heading level by color. My idea was to implement a small line holding the order of the heading colors into each odd head rule. Is it possible to add the code below in such a way that I might get the result shown in the picture:

\makeheadrule{standard}{\textwidth}{\normalrulethickness}


I just picked random colors here, but if possible, I would decide on colors that would be distinguishable by the colorblind.

I guess the easiest would be to add the coloured squares to the \makeoddhead

\documentclass{memoir}

\makepagestyle{standard} % Make standard pagestyle

\makeatletter                 % Define standard pagestyle
\makeevenfoot{standard}{}{}{} %
\makeoddfoot{standard}{}{}{}  %
{\color{yellow}\rule{1em}{1em}}%
{\color{orange}\rule{1em}{1em}}%
{\color{red}\rule{1em}{1em}}%
{\color{purple}\rule{1em}{1em}}%
{\color{blue}\rule{1em}{1em}}%
{\color{cyan}\rule{1em}{1em}}%
{\color{green}\rule{1em}{1em}}%
\makeatother                  %

\makeatletter
\makepsmarks{standard}{
}
\makeatother                               %