I want something working like a fancyhdr, but on the page margin: A colored box overlayed with the document title (or any other text) on every page, placed vertically inside the page margin. The box should be placed on the outer margin (right on odd, left on even pages) and should be easily enabled/disabled (e.g. using fancy styles). An example is the blue box to the left in the below image for an even page:
On an odd page, I would like to have the same box/text, but rotated 180 °:
My concrete example is a blue box, but a general solution that would allow graphics as well is also higly appreciated!