Marks on the page / Colour key legend
A colour key that still works when the page is printed in grey
A legend mapping colours to meanings, beside a chart, a plan or a coded table.
Why this block is harder than it looks
A colour key is the one block whose entire content is colour, so it is the block most damaged by monochrome printing and by print settings that drop backgrounds. Five colour swatches printed in greyscale become five similar greys, and the reader can no longer match any of them to the marks on the plan. The layout answer is that the swatch has to carry a second, non-colour signal, and the same signal has to appear on the thing being keyed, which means the key and the artwork have to be designed together rather than the key added afterwards.
The decisions that make it work
Reasons rather than a description of the code. Each of these is a choice that has a wrong answer, and the wrong answer is usually the default.
- Give every swatch a pattern, a border weight or a symbol as well as a fill, and use the same one on the artwork.
- Order the entries to match the order they appear on the artwork, or by magnitude, rather than alphabetically. A key ordered by name is a lookup; a key ordered like the data is readable.
- Set print-color-adjust: exact on the swatches, and design so the key still works if it is ignored.
- Put the key beside the artwork rather than below it, and keep the two in one break-inside: avoid container so they cannot be separated.
- Label each swatch with words, not just a code. A key whose entries are A, B and C requires a second key.
- Limit to about six entries. Beyond that people stop using the key and start reading the labels on the artwork, which means the artwork needed direct labels instead.
The fragment
Markup and the CSS it needs, and nothing else. It expects a document that already has a page rule and a base stylesheet, so paste it into one rather than opening it on its own.
<div class="keyed">
<svg class="art" viewBox="0 0 300 180" role="img" aria-label="Site plan">
<rect x="10" y="10" width="120" height="70" fill="#e6e2d6" stroke="#1d1812"
stroke-width="2"/>
<rect x="150" y="10" width="120" height="70" fill="#e6e2d6" stroke="#1d1812"
stroke-width="2" stroke-dasharray="6 4"/>
</svg>
<ul class="key">
<li><span class="sw solid"></span> Inspected</li>
<li><span class="sw dashed"></span> Not accessible</li>
</ul>
</div>
<style>
.keyed {
display: grid;
grid-template-columns: 1fr auto;
gap: 8mm;
align-items: start;
break-inside: avoid; /* key and artwork are one unit */
}
.keyed .art { width: 100%; height: auto; }
.keyed .key { list-style: none; margin: 0; padding: 0; font-size: 8.5pt; }
.keyed .key li { display: flex; align-items: center; gap: 3mm; margin-bottom: 3pt; }
.keyed .sw {
width: 8mm; height: 5mm;
background: #e6e2d6;
border: 1.5pt solid #1d1812; /* the same signal used on the artwork */
print-color-adjust: exact;
-webkit-print-color-adjust: exact;
}
.keyed .sw.dashed { border-style: dashed; }
</style>What breaks when it is built the obvious way
Distinguishing the entries by fill colour alone. Photocopy the page and every swatch becomes a similar grey, so the key stops mapping to anything and the artwork it belongs to becomes unreadable at the same moment.
How to prove it survived pagination
Photocopy the page in black and white and try to match each swatch to the marks on the artwork. If you cannot, the second signal is missing or too subtle. Then confirm the key did not end up on a different page from the thing it keys.
Where it sits in a finished document
This page is one block. The document it belongs to has a page rule, a base stylesheet, a header and everything else around it, and repeating all of that here would make thirty pages that say the same thing. The incident report template is a complete file with this block already in it, so take that and change the fragment rather than assembling one from parts. The property doing most of the work here is covered on its own page, with the support caveats that belong there rather than here.
Frequently asked
Will this fragment work on its own?
Not as a whole document. It has no page rule, no margins and no base type, because those belong to the document rather than to the block, and duplicating them in every fragment would mean thirty copies to keep in step. Paste it into a template that already has them.
Why does it look right in a browser and wrong in the PDF?
Because a browser window is one continuous surface and a document is a stack of fixed rectangles. Nothing in a scrolling view exercises a page boundary, so every break rule in the fragment is inert until the content is paginated. Render the real thing with enough content to cross two or three boundaries, then look.
Do I need a special option on the render request for this?
No. Everything on this page is CSS and markup, which is your side of the boundary. What the render has to give you is a real page size with real margins, and after that the layout is decided by the stylesheet.
Other parts of a document
The blocks that sit next to this one, and one from the next group along so you are not sealed inside a single kind of problem.
Numbered steps that stay readable when followed one handed
An ordered procedure with prominent numbers, followed by somebody holding the document while doing something else.
A DRAFT watermark on every page that does not obscure the text
A large word set diagonally behind the content on every page, used to mark a document as a draft, a copy or a specimen.
A letterhead on the first page only, with the rest indented under it
The organisation's name, mark and address at the head of a document, usually on the first page only, with the body starting below it.
A time log where start, end and duration are all checkable
Rows of start time, end time and elapsed duration, with a total, used on timesheets, service reports and anything billed by the hour.
Incident report, as a complete file
The whole document with this block already in place, ready to copy and change.
print-color-adjust in paged output
The property carrying the weight here, with its real support status.
Every part of a document
The full list, grouped by the kind of problem the block poses.
Paste the fragment into the playground inside a page rule and see what it does at a real page size. That is the only way any of this gets confirmed.