Definition of the needs
The problem, and what is aimed at
One palette does not answer every reader. What is read for an hour is not read as what is glanced at, a page of an institution is not a page of a presentation, and what one reader finds legible another finds tiring. Colours, weights and shapes answer needs and tastes that differ, and a framework that carries one palette answers only its own.
A theme is also a way of answering a disability, beside conformance. WCAG says what a text must hold against its ground; it does not say that a reader may want colours that go well beyond it, on every element and not on the text alone. A palette drawn for that is not a conformance box: it is a way of reading.
What is aimed at: a document whose look is chosen by whoever reads it, among the ones the page offers, without the page being written twice and without the framework being touched.
Elicitation of the needs
Six things are handled, and they are all that is handled.
TH1. A variable is what a look is made of: a colour, a size, a weight, a shape. The framework gives every one of them a value.
TH2. A theme is a set of variables written together, under a name. It redefines what it wants and leaves the rest.
TH3. A group is what variables answer together: a ground and the text laid on it, a button and the colour it takes under the pointer. A group is answered whole or not at all.
TH4. A mode is how a document is read: light or dark. Every group has a value in each of the two.
TH5. The theme in force is the one a document is shown with. There is one at a time, and the reader chooses it.
TH6. The contrast mode is not a theme. It belongs to the accessibility layer of the framework, which owns it: a theme does not define what a document looks like when it is read in that mode.
Organisation of the needs
TH10 What a theme answers
- TH11 The author can give a document a look of its own without touching the framework.
- TH12 A theme redefines the variables it wants, and what it leaves keeps the value the framework gives it.
- TH13 A theme may be drawn for a way of reading — colours that go beyond what conformance asks, on every element — and not for a taste alone.
- TH14 A theme never defines what a document looks like in contrast mode: that mode belongs to the accessibility layer. TH6
- TH15 A theme is written without fighting the framework: no rule of the framework has to be beaten, and nothing is forced.
TH20 Choosing a theme
- TH21 The reader can choose the theme the document is shown with.
- TH22 One theme is in force at a time, for the whole document.
- TH23 The theme in force is the same from one page of the document to the next.
- TH24 The theme in force changes without the page being loaded again.
- TH25 The author says which themes a page offers, and in which order they are walked through.
- TH26 The author says which one is shown when nothing else is said.
TH30 What a theme is made of
- TH31 A theme defines variables and nothing else: no rule of its own, no selector of the framework rewritten.
- TH32 A group of variables is answered whole, in the two modes: a ground without the text laid on it borrows a colour from another palette. TH3
- TH33 A theme that touches no variable of a group leaves that group to the framework, whose palette holds on its own.
- TH34 What has no mode of its own is defined once, and read the same way in both.
TH40 Where a theme stands
- TH41 The author says where his theme stands, wherever that is: beside the page, at the root of the site, or on another host.
- TH42 A theme the framework carries is named without saying where it stands.
- TH43 The reader sees the theme on a document opened from a disk, with no server.
TH50 What is guaranteed
- TH51 A name no page offers changes nothing, and is said in the console.
- TH54 A page that offers one theme alone has nothing to switch, and is told so when it says it — not when a reader asks for the next one.
- TH52 A document whose theme does not load is read all the same, in the palette of the framework.
- TH53 Nothing of the theme is asked of the internet.
What was set aside
Showing two themes at once, so that they can be compared. Adding a theme once the page is open. A theme of its own for the printed page: what is printed is answered by the print stylesheet, and a theme that had to be written twice would be written wrong once.
The constraints
What the code holds to
| No. | Constraint | Comes from |
|---|---|---|
| C1 | A theme that defines one variable of a group defines them all, in the two modes | TH32, TH3 |
| C2 | A theme defines no colour under the contrast mode: what that mode looks like is the accessibility layer's and nothing else's | TH14, TH6 |
| C3 | A theme is read after the framework and defines variables only: it never has to beat a rule, and never writes one | TH15, TH31 |
| C4 | The themes a page offers are registered before anything reads the address: a name registered afterwards is one the manager has already refused | TH21, TH23 |
| C5 | The order the page writes is the order the reader is taken through, and the one shown by default closes the walk | TH25, TH26 |
| C6 | Changing the theme in force changes one address and nothing else: no page is loaded again, and nothing of the document is built twice | TH24 |
| C7 | The name in force is written in the address of the document, and carried to the addresses the page names | TH23 |
| C8 | Where a theme stands is written by the page and read as the page writes it, the framework's own being named without a place | TH41, TH42 |
| C9 | Registering one theme alone is said when it is registered: a walk of one step is a page that offered one theme, and the page is what has to be corrected | TH54 |
The decisions
The decisions of the tool
D1. A theme is a stylesheet of variables, swapped on one link. The
document carries a <link id="wexa-theme"> and changing
the theme changes its address. One link and not several: two stylesheets
that both define a palette answer at the same time, and which one wins is
read in their order rather than in the choice of the reader.
D2. A theme defines variables, never rules. The framework writes its rules in layers, and a theme that wrote rules of its own would beat them all, whatever their specificity. What a theme is allowed to change is therefore what the framework reads from a variable, and the answer to TH15 is a rule of writing and not a mechanism.
D3. The contrast mode is not answered by a theme. It is written in
@layer accessibility, which owns the class it hangs on. A
theme that redefined a colour there would answer for a reader it was not
drawn for, and the mode would differ from one theme to the next
(TH14).
D4. A group is answered whole, and a build says so. The contract is written group by group, and every theme of the framework is held to it before a release: what is left half defined is only seen in the mode nobody opened (C1).
D5. What the framework carries is an inventory, written from its folder, as the reference set of the icons is. The loader reads it and does not know it: a theme added to the framework is named by its file, and nothing in the loader is written again (TH42).
D6. A page says on one attribute which themes it takes, and in which
order. A name alone is one of the framework, name:path is
one the page brings. The order written is the order walked through, which
is what makes the default the end of the walk rather than a special case
(TH25, TH26, C5).
D7. Naming one of the framework's is choosing among them; naming none is taking them all. Bringing a theme adds one, and says nothing of the others: a page that declares its own keeps the three, which is what a page that brings a look of its own almost always wants. A page that wants one of them alone names it, and a page that says nothing at all takes the three, as it did before the attribute existed.
D9. A page that offers one theme is told when it says so, and not when a reader asks. The fault is known the moment the themes are registered: waiting for the button to be pressed says it late, and says it only if it is pressed at all. It is written in the console at the level of a warning, where whoever wrote the page will read it (TH54, C9).
D8. The name in force is written in the address, and nowhere else. Not in the browser's storage: a choice kept there is not carried by a link, and a document read from a disk keeps it for a page nobody shares. The address is what travels (TH23, C7).