Diagrams and demos

One visual language for every drawing in this repository: the static SVG diagrams in diagrams/ and the interactive demos in teaching-demos/. Every swatch and example on this page is drawn by the real stylesheets.

1. Rules on one screen

  1. Pick the medium. If it needs to move or respond to the student, it is a demo (an HTML page in teaching-demos/<topic>/). Otherwise it is a diagram (an SVG file in diagrams/). Both use the same classes.
  2. Classes only. A shape says what it is; the stylesheet decides how it looks. No fill, stroke or style attributes in a diagram, ever. A demo may set CSS variables inline or from script, never literal colours.
  3. Colour is a role plus a hue: class="ag-box ag-blue". Leave the hue off and it draws in ink. A hue on a <g> colours everything inside it.
  4. Most of a drawing is quiet. Context in ag-faint or ag-ghost, supporting structure in ag-muted, only the subject at full strength. If everything is ink, there is no subject.
  5. Reach for the three core colours first (blue, terracotta, green). At most one thing per drawing wears ag-highlight. The twelve specific hues are for depicting real things, not for telling parts of a schematic apart.
  6. Two palettes, never mixed in meaning. Schematic colours distinguish (blue because it is not the green one); physics colours depict (grey because it is steel). Heat is always ag-heat.
  7. Canvas. Diagrams: viewBox="0 0 1200 675" unless the content is genuinely a different shape; the width follows the display width. Demos: about 700 wide, inside an element with class="ag-demo".
  8. Labels are small and drawn in the colour of the thing they name, so a legend is rarely needed.
  9. Arrows are a ag-connector path plus a separate ag-arrowhead polygon. Never an SVG <marker>.
  10. Accessible by default. A diagram's <title> is its alt text. Alt text and captions end with a full stop. Demo controls are <label for> / id pairs; output a screen reader needs is exposed with ARIA.
  11. Never invent a local style. If a pattern is missing, add it to the framework: agDrawing.css if both media could use it, otherwise the layer. Record the decision in CLAUDE.md.

2. The three files

FileHoldsWho links it
framework/agDrawing.css The shared language: neutrals, hues, roles, text, arrows, materials, heat, temperature, particles, graphs, modifiers. Nobody directly. Both layers import it.
framework/agDiagrams.css The diagram layer: canvas rules (documented), the ground, and document defaults for svg and text. Every diagrams/*.svg, from its second line.
framework/agTeachingDemos.css The demo layer: .ag-demo (type sizes for the demo canvas), slider and meter controls, marching motion. Every teaching-demos/**/*.html.

The test for which file something belongs in: if it changed in one medium, should it change in the other too? Heat colour, ink, line weights and arrowheads: yes, so they live in agDrawing.css. Slider styling and the diagram ground: no, so each lives in its layer.

Changing the style needs no rebuild. Diagrams and demos link the stylesheets rather than copying them, and decks embed diagrams as <object> and demos as <iframe>, which load the live files. Edit a value in agDrawing.css and every diagram, every demo and every deck that shows them changes the next time it is opened. A deck only needs rebuilding when its own markdown changes.

The slide system (agSlides.css, build.html, template.md) is separate and documented in template.md. It styles the deck around a drawing, never the drawing itself.

3. How styling works

Semantic classes

SVG elements carry no paint. Each gets classes describing what it is, and the stylesheet supplies the appearance. That is what makes it possible to restyle hundreds of drawings at once, years after they were made.

<rect class="ag-box ag-blue" .../>          <!-- a role and a hue -->
<path class="ag-line ag-fine ag-faint" .../>  <!-- a role, a weight, a neutral -->
<rect class="ag-metal ag-outline" .../>      <!-- a material, outlined -->
An inline style beats a stylesheet. A shape carrying style="fill:#000000" or fill="#000" ignores the house style for ever, including the day everything else is restyled. Inkscape adds these to every object without being asked: use the ? (unset) button in Fill & Stroke and save as Plain SVG.

Two layers of colour variables

Every raw colour is named once as a --ag-c-* variable. Roles point at those rather than repeating a hex value. For example, --ag-c-axis is var(--ag-c-muted), so a near-duplicate grey can never creep back in. A hue class sets three carrier variables (--ag-h-tint, --ag-h-base, --ag-h-shade), and the role class decides which to paint with.

Overrides in demos

A demo may set variables inline or from script to tie appearance to physics: --ag-march-speed, --ag-c-particle, --ag-particle-r, --ag-c-metal (a named tint) and --ag-h-base (a computed colour on one shape). It sets a variable, so the stylesheet keeps the final say. Diagrams never do this.

Source order matters (for whoever edits the CSS)

Classes are stacked, and when two single-class rules set the same property, the one later in the file wins. agDrawing.css is therefore ordered on purpose: tokens, then neutrals and hues (which set only variables, so they are order-proof), then physics, roles, graphs and text, and finally the modifiers (ag-fine, ag-heavy, ag-dashed, ag-translucent), which must stay last. In text, the colour modifiers must come after the size classes. Two real bugs came from getting this wrong. The safest new modifier sets a variable that a role reads.

4. Making a diagram

The short practical checklist lives in diagrams/readme.txt. This section is the full version.

The file

Copy diagrams/_template.svg (the underscore keeps it out of the index checks) and rename it. Names are lowercase and hyphenated, topic first: conduction-plane-wall-element.svg. A series shares a prefix and a number (cfd-history-1-separate, -2-overlap…), and is built to be shown in order, so it shares a canvas, a layout and a colour assignment. The folder is flat: a diagram wanted by CFD and heat transfer has no correct topic subfolder.

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="../framework/agDiagrams.css" type="text/css"?>
<!--
  Created YYYY-MM-DD: what it is for.
  THE TEACHING POINT. ...
  STYLE. ...   GEOMETRY. ...   (anything a later edit will need)
-->
<svg xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 1200 675" width="1200" height="675">
  <title>What the diagram shows, as a real sentence.</title>
  <desc>Optional: what the title cannot carry.</desc>
  <rect class="ag-ground" x="0" y="0" width="100%" height="100%"/>
  ...the drawing...
</svg>

The canvas

Every diagram is drawn on viewBox="0 0 1200 675": 16:9 like the slide canvas, and about 90 mm tall at full A4 text width. Treat it as the box, not a default to adjust. Diagrams that share a frame read as a set.

A cramped drawing is not a reason to change the box. It is a reason to simplify the drawing or split it in two.
1200 × 675The default. Full slide width, or full A4 text width. Use this.
600 × 675Half width: one side of a two-column slide. Should be rare.
1200 × 400Long and thin: a timeline, a spectrum, a sequence.
600 × 1000Tall and narrow: a vertical stack, strata, a process running down the page.

Leaving the default needs a reason about the shape of the content. The width is not a free choice. Strokes and text are in user units, so a 1200-wide box shown in a half-width column renders every line at half weight. Use 1200 for a diagram shown full width and 600 for one shown half width. Height follows the content. (The 2-D and 3-D conduction elements use 600 × 540 and 600 × 600: half-width companions cropped to their content.)

Why half width should be rare: columns stack on a phone and lose the pairing that justified them; written notes want a figure with explanation above and below rather than beside it; and in a lecture the thing next to a diagram should usually be your voice.

Drawing it

Text that describes it

Registering it

Add an entry to diagrams/diagrams.json with alt and caption. The index exists for findability: grep it rather than opening SVGs one by one. Building a deck from the command line (convert.bat) reports diagrams missing from the index, entries whose file has gone, and diagrams a deck uses that are not listed. The index is a record, not the source: decks write their own alt text and captions, so keep them in step by hand.

Using it in a deck

![Alt text: what the diagram shows.](/diagrams/conduction-plane-wall-element.svg)
: Caption: what it means.

The leading slash means "from the site root"; the builder rewrites it for the deck's depth. The builder embeds any .svg as <object>, never <img>. An SVG inside <img> renders in a secure static mode that refuses its linked stylesheet, so it would arrive as black shapes.

Checking it

Open the .svg directly in a browser: it should look finished. Black shapes mean the stylesheet is not loading or a shape is unclassed (see section 17).

5. Making a demo

What a demo is

A demo is an embeddable component: one concept, one interaction, model or visualisation, designed to sit inside a lecture deck, a web page or the VLE. It has no page title, header, navigation or footer, and keeps its text short. The fuller explanation belongs in the teaching material that embeds it. It lives at teaching-demos/<topic>/<descriptive_name>.html, mirroring the lecture that uses it.

The skeleton

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Short descriptive title</title>
<link rel="stylesheet" href="../../framework/agTeachingDemos.css">
<style>
  /* DEMO-LOCAL: arrangement only. No colours, weights or fonts here. */
  .demo { display: flex; flex-wrap: wrap; gap: 1rem;
          align-items: flex-start; max-width: 860px; }
  .demo svg { flex: 1 1 340px; min-width: 0; height: auto;
              max-width: 600px; max-height: 85vh; }
  .demo-controls { flex: 0 0 200px; }
</style>
</head>
<body>
<div class="demo ag-demo">

  <svg id="fig" viewBox="0 0 700 400" xmlns="http://www.w3.org/2000/svg"
       role="img" aria-label="What the figure shows.">
    <rect class="ag-metal ag-outline" .../>
    <g id="arrows" class="ag-heat"></g>
    <text class="ag-label" ...>Q in</text>
  </svg>

  <div class="demo-controls ag-controls">
    <label for="iQ">heat rate Q</label>
    <input type="range" id="iQ" min="1" max="5" step="0.1" value="3">
  </div>

</div>
<script>
"use strict";
/* Header comment: the physics, the visual encodings, and why. */
</script>
</body>
</html>

The rules that differ from a diagram

Sizing for an iframe

Cap the component at about 860px wide. Give the SVG a flex basis of 340px, a max-width of about 600px and max-height: 85vh. Inside an iframe, vh is the iframe's own height, so the figure shrinks to fit whatever box the host gives it instead of clipping. Trim dead space from the viewBox. A typical host embed is about 840 × 460.

Accessibility

Motion

Motion that carries the physics is essential and always animates: a particle jiggle that is the temperature (WCAG 2.3.3 exempts essential animation). Decorative motion respects the reduced-motion preference: marching dashes stop automatically. Sweeping whole-view motion (an animated pan-and-zoom) becomes an instant jump under the preference. The preference is an honour system: it stops nothing unless the page opts in. Windows surfaces it as Settings > Accessibility > Visual effects > Animation effects.

Patterns that have worked

Security

Assume students will poke at it. Demos are static pages with no server and no stored data. Never build markup from anything a user can type: use textContent, not innerHTML, for any text that did not come from the demo's own constants.

Using it in a deck

::: {.demo src="/teaching-demos/heat-transfer/1D_conduction_sim.html" height="460"}
:::

The demo is live during the lecture. The working examples to copy from are teaching-demos/heat-transfer/ (conductions_physics, 1D_conduction_sim, convection_physics, conductivity_scale) and teaching-demos/cfd/cfd_cell_refinement. composite-wall.html predates the framework and is not an example.

6. Hierarchy: the neutrals

The palette is the easy half. What separates a designed set of drawings from an amateur one is that most of a good drawing is quiet and only the subject is at full strength. The neutrals are named for their job, because the name is the instruction.

.ag-inkthe subject
.ag-mutedsupporting
.ag-faintcontext
.ag-ghostscaffolding
hairlineseparators, gridlines, box fills (a variable, no class)

A neutral is used exactly like a hue, stacked on a role: class="ag-line ag-faint", class="ag-box ag-ghost". On its own it does nothing. Each also resets tint and shade, so a ghost box inside a blue group is still a ghost box.

everything at full strength: no subject hierarchy: the eye lands immediately
The same six boxes. The only difference is what was allowed to be loud.

7. Line weights

Three weights, and they are not equal citizens: regular should carry about nine tenths of every drawing.

ag-fine: hatching, ticks, dimensions, construction (no modifier) regular: almost everything ag-heavy: the one emphasised thing

Values: --ag-sw-fine , --ag-sw-regular , --ag-sw-heavy . ag-dashed adds a 7/5 dash to any stroke.

8. Colour: roles and hues

A shape takes a role class (how it is painted) and a hue class (which colour). Each hue provides a tint for large fills, a base for strokes and solids, and a shade for text sitting on the tint. Tint fill, base outline and shade text never need a contrast check.

RolePaints
.ag-boxTint fill, base outline, rounded corners. The workhorse.
.ag-shapeThe same paint, no corner radius: circles, ellipses, polygons, free paths.
.ag-solidBase fill, no outline. Also how to give one shape a computed colour from script: set --ag-h-base on it.
.ag-lineBase stroke, no fill, round caps and joins. Lines, rules, data curves.
.ag-connectorThe shaft of an arrow.
.ag-arrowheadThe head of an arrow (a filled polygon).
.ag-label-hueText in the base colour. .ag-label-shade: text in the shade, for use on the tint.
ModifierEffect
.ag-fine .ag-heavyStroke weight.
.ag-dashedA 7/5 dash.
.ag-translucentBase colour at reduced fill opacity, for a schematic volume with geometry visible behind it. Paint each volume once rather than stacking translucent faces, which makes dark seams.
ag-box label-hue ag-shape ag-solid ag-line connector + arrowhead
One hue class on the group; every role inside picks the right part of it.

The three core colours

Reused constantly, and that reuse is what creates the identity. Reach for these first. Deliberately muted: nothing here is a pure hue. Violet is deliberately absent because it belongs to the slide chrome.

.ag-blue
.ag-terracotta
.ag-green

The highlight

One per drawing, and nothing else wears it. Its whole power is scarcity: the moment two things are pink, neither is emphasised.
.ag-highlight

The twelve specific hues

For depiction, not distinction: when you draw a Ferrari it has to be red. Do not use these to tell parts of a schematic apart; a schematic wearing eight hues has no identity. The recorded exception is a data plot with many series (cfd-residuals-convergence.svg), where each series gets its own hue and a label in that hue.

.ag-red
.ag-orange
.ag-amber
.ag-olive
.ag-lime
.ag-teal
.ag-cyan
.ag-indigo
.ag-violet
.ag-magenta
.ag-brown
.ag-slate

9. Text

Quiet and small, with air around it. Text set large is the fastest way to make a drawing look like a poster. Label a thing in the colour of the thing it names and a legend is rarely needed.

ag-label-title: rarely needed ag-label: the default for almost everything ag-label-small: annotations and asides + ag-label-faint: must not compete + ag-label-hue ag-terracotta + ag-label-inverse Q̇x ag-math (the subscript inherits it)
ClassUse
.ag-labelThe default label. Ink.
.ag-label-smallAnnotations, ticks, subscripts. Muted.
.ag-label-titleA heading inside a drawing. Usually unnecessary: the slide or caption has one.
.ag-axis-labelAxis titles and tick labels: label size, axis colour.
.ag-label-faintModifier: text that must not compete.
.ag-label-hue / .ag-label-shadeModifier: text in the hue's base / shade.
.ag-label-inverseModifier: light text on a dark fill (iron, a solid muted block).
.ag-mathItalic serif, for variables as they appear in print.
.ag-axis-label-verticalRotates a y-axis title 90° about its own centre; place the text at its centre point.

Sizes are user units and depend on the canvas. A diagram on 1200 uses --ag-fs-label 22, --ag-fs-small 17, --ag-fs-title 28. Inside .ag-demo the same classes are 13, 11 and 16. Fonts are inherited from the svg (set by each layer), never set on the label classes, which is what lets a maths <text> pass its italic serif to a subscript <tspan>.

10. Arrows, heat and motion

An arrow is a stroked path plus a separate filled head, never an SVG <marker>: browsers cannot reliably recolour marker content from CSS. Use one head shape and size everywhere: copy the polygon and rotate it.

<path    class="ag-connector" d="M 100 100 H 280"/>
<polygon class="ag-arrowhead" points="292,100 276,92 276,108"/>

<!-- rotated: the head drawn pointing right at the origin, then placed -->
<polygon class="ag-arrowhead" points="0,0 -18,-9 -18,9"
         transform="translate(976,268) rotate(-45)"/>

Heat

Heat is a hue, .ag-heat, the dark orange used for heat in every diagram and demo. It holds the same values as terracotta, but in separate variables. Heat is physics and terracotta is a schematic category (it means "engineering" in the CFD diagrams), so recolouring one must not recolour the other. Put it on the group:

<g class="ag-heat">
  <path    class="ag-connector" d="M 805 310 H 887"/>
  <polygon class="ag-arrowhead" points="905,310 887,301 887,319"/>
</g>
<text class="ag-label ag-math ag-label-hue ag-heat">Q̇</text>

Marching dashes (demos only)

In a demo, add ag-marching to make the dashes march along a connector, usually with ag-heavy. The speed is a variable, so it can follow a physical magnitude (set on the svg or a group; lower is faster). The animation stops automatically under the reduced-motion preference. It lives in the demo layer because a diagram is static.

<g id="arrows" class="ag-heat">
  <line    class="ag-connector ag-heavy ag-marching" x1="28" y1="150" x2="85" y2="150"/>
  <polygon class="ag-arrowhead" points="85,143 98,150 85,157"/>
</g>

fig.style.setProperty("--ag-march-speed", (1.6 / flux).toFixed(2) + "s");
ink ag-blue ag-highlight ag-dashed ag-heat ag-heat + ag-connector ag-heavy ag-marching (demo layer)

11. Physics palette: materials and temperature

Colours that are their meaning. They hold their own values and never borrow a schematic colour, so restyling the schematic palette cannot recolour the physics.

Materials

Material classes are pure fills; they say what a region is made of and nothing more. Add .ag-outline to outline one (ink, regular weight, via --ag-c-outline and --ag-sw-outline, which a drawing can override separately).

ag-metal ag-water ag-air ag-insulation ag-brick ag-wood ag-plastic ag-stone
Metal is shown flat here; see the shiny version below. (This page contains the metal gradient, so this one swatch forces its flat fill. A real drawing never needs to.)

Shiny metal: the gradient defs block

CSS alone can only make flat fills in SVG; a metallic sheen needs a gradient defined inside the SVG. Paste this block once, just inside the <svg>, to make every .ag-metal shiny. Without it, .ag-metal falls back to the flat grey automatically. The gradient scales to each shape.

<defs>
  <linearGradient id="agMetalGradient" x1="0" y1="0" x2="0" y2="1">
    <stop offset="0"    stop-color="#e9edf1"/>
    <stop offset="0.45" stop-color="#9daab6"/>
    <stop offset="0.6"  stop-color="#c6cdd5"/>
    <stop offset="1"    stop-color="#8b98a5"/>
  </linearGradient>
</defs>

(The one place colour values appear in markup: a gradient's stops cannot be set from CSS in every browser. Copy the block exactly.)

with the defs block (shiny) without it (flat fallback)
Gradients resolve document-wide. If the defs block appears anywhere on a page, every .ag-metal on that page is shiny, including ones in other SVGs. That is why this page forces flat fills on its flat examples.

Named metal tints

A flat material fill can be recoloured per element by overriding its variable. Use these named tints rather than inventing colours, so the same metal is the same colour in every drawing:

<rect class="ag-metal ag-outline" style="--ag-c-metal: var(--ag-c-metal-copper)"/>
iron default titanium iron (inverse label) aluminium gold copper

Tints work only on flat fills. With the metal gradient present, every metal shares the one gradient, so a drawing that needs distinguishable metals leaves the defs block out (as conductivity_scale.html does). New tints are added only when a drawing needs them. Iron is dark enough that a label on it needs ag-label-inverse.

Heat

.ag-heat: see section 10.

.ag-heat

Temperature: cold to hot

The two ends of a temperature colour scale. There is no class, because anything coloured by temperature computes its colour. Mix the two variables in CSS so the colours stay in the stylesheet:

el.style.setProperty("--ag-c-particle",
  `color-mix(in srgb, var(--ag-c-hot) ${pct}%, var(--ag-c-cold))`);
--ag-c-cold --ag-c-hot as convection_physics.html colours its air

12. Particles

Small dots for atoms and molecules: conduction lattices, gas models. The framework styles the dot, and any motion is the demo's JavaScript. Size, body colour and outline are variables, overridable on the svg, a group or one particle.

<circle class="ag-particle" cx="30" cy="20"/>   <!-- radius comes from the stylesheet -->

The radius is set by the stylesheet: the CSS r property overrides any r="" attribute, so resize with --ag-particle-r, never the attribute.

Shiny particles. Like metal, particles become 3-D balls when this block is in the SVG. The gradient derives its highlight and shade from --ag-c-particle, so one override retints the whole ball:

<defs>
  <radialGradient id="agParticleGradient" cx="0.33" cy="0.3" r="0.85">
    <stop offset="0"    style="stop-color: color-mix(in srgb, var(--ag-c-particle), #ffffff 80%)"/>
    <stop offset="0.35" style="stop-color: var(--ag-c-particle)"/>
    <stop offset="1"    style="stop-color: color-mix(in srgb, var(--ag-c-particle), #000000 45%)"/>
  </radialGradient>
</defs>
shiny resized flat (no defs) flat, recoloured
The flat ones force their flat fill only because this page holds the particle gradient; in a real demo, leaving the defs block out is enough.

Recolouring. A shiny particle's gradient reads --ag-c-particle where the defs block sits, not where the particle is. So to recolour shiny particles, set the variable on the <svg> itself; setting it on a group or a single particle does nothing. Flat particles (no defs block) can be recoloured one by one, which is why convection_physics.html omits the block. Browsers without color-mix() (pre-2023) show flat particles.

13. Graphs

Axes, gridlines and axis labels. Gridlines are the light reference lines that divide or locate regions; they are as useful outside graphs (projecting a layer boundary down onto a temperature profile). Draw them first, so they sit under the data. Use one <polyline> for an L-shaped pair of axes.

Data curves are ordinary lines with a hue: class="ag-line ag-red". With one or two curves, use red then blue. A plot with many series may give each its own specific hue, labelled in that colour at the end of the curve, so no legend is needed.

curve 1 curve 2 annotation x 0 T (°C)
Drawn inside .ag-demo at the width a demo figure gets, so the text is at demo size. The same classes in a diagram come out at diagram size.
ClassVariablesNotes
.ag-axis--ag-c-axis (muted), --ag-sw-axisAxes and tick marks.
.ag-axis-label--ag-c-axis, --ag-fs-labelAxis titles and tick labels.
.ag-axis-label-vertical—Rotates a y-axis title; place the text at its centre.
.ag-gridline--ag-c-gridline (hairline), --ag-sw-gridline (fine)Add ag-dashed for a reference level (ambient, say).
.ag-line + huehue variablesA data curve.

14. Demo controls

The HTML control panel beside a demo: the one part of the system that styles HTML rather than SVG. Wrap controls in .ag-controls; each slider is a <label for> / <input type="range" id> pair, with an optional .ag-readout for its live value.

<div class="ag-controls">
  <label for="iQ">heat rate Q <span class="ag-readout" id="oQ">3.5</span></label>
  <input type="range" id="iQ" min="1" max="5" step="0.1" value="3.5">
</div>

Qualitative demos give a slider a word label only (the second slider); quantitative ones show a readout with units (the first).

Read-only meter

A value the user cannot adjust, typically one computed from the other sliders. A filled bar with no thumb: the missing thumb is the signal that this is a display, not a control. Update aria-valuenow and the fill's width together.

<span class="ag-meter-label" id="hLabel">h</span>
<div class="ag-meter" role="meter" aria-labelledby="hLabel"
     aria-valuemin="0" aria-valuemax="1" aria-valuenow="0.75">
  <div class="ag-meter-fill" style="width: 75%"></div>
</div>
convective h.t.c (h)

Control variables: --ag-c-control-accent (slider, readout and meter fill; chosen for text contrast), --ag-c-control-text, --ag-c-control-border and --ag-c-control-surface (for demo-local panels, results boxes and buttons, so those follow the framework too), and --ag-c-meter-track.

Not yet in the framework (each still local to one or two demos; promote when a second demo needs it): results box, button group, dropdown, radio row, the shared iframe layout, and the speedometer gauge (convection_physics.html).

15. Index of classes

ClassFileMeaning
ag-ink ag-muted ag-faint ag-ghostDrawingNeutral hues: the hierarchy. Stack on a role.
ag-blue ag-terracotta ag-greenDrawingCore hues: reach for these first.
ag-highlightDrawingOne thing per drawing.
ag-red ag-orange ag-amber ag-olive ag-lime ag-teal ag-cyan ag-indigo ag-violet ag-magenta ag-brown ag-slateDrawingSpecific hues, for depiction.
ag-heatDrawingHeat, everywhere.
ag-metal ag-water ag-air ag-insulation ag-brick ag-wood ag-plastic ag-stoneDrawingMaterial fills.
ag-outlineDrawingOutline a material region.
ag-particleDrawingAn atom or molecule.
ag-box ag-shape ag-solid ag-lineDrawingRoles: how a shape is painted.
ag-connector ag-arrowheadDrawingArrow shaft and head.
ag-axis ag-gridlineDrawingGraph strokes.
ag-label ag-label-small ag-label-title ag-axis-labelDrawingText sizes.
ag-label-faint ag-label-hue ag-label-shade ag-label-inverseDrawingText colour modifiers.
ag-math ag-axis-label-verticalDrawingMaths font; vertical axis title.
ag-fine ag-heavy ag-dashed ag-translucentDrawingStroke and fill modifiers.
ag-groundDiagramsThe card a diagram sits on. First element.
ag-demoDemosThe demo component root: font and demo type sizes.
ag-controls ag-readoutDemosControl panel and live value.
ag-meter ag-meter-fill ag-meter-labelDemosRead-only meter.
ag-marchingDemosMarching dashes.

16. Index of variables

Values are read from the stylesheets as this page loads. Change one in the CSS and it changes here too.

VariableValuePurpose
Foundations (agDrawing.css)
--ag-font-uiLabels, controls.
--ag-font-monoReadouts.
--ag-font-mathMaths variables.
--ag-sw-fine / -regular / -heavy / / The three line weights.
--ag-fs-label / -small / -title / / Type sizes on the 1200 canvas.
… inside .ag-demo / / Type sizes on the demo canvas (agTeachingDemos.css).
--ag-box-radiusCorners of ag-box.
Colour (agDrawing.css)
--ag-c-ink … --ag-c-hairlinesection 6The neutrals.
--ag-c-<hue>, -tint, -shadesection 8Every hue, e.g. --ag-c-blue-tint.
--ag-h-tint / -base / -shade(set by hue classes)Carrier variables the roles read. Set --ag-h-base from script for a computed colour.
--ag-c-heat, -tint, -shadeHeat.
--ag-c-cold / --ag-c-hot / Ends of the temperature scale.
--ag-c-metal -water -air -insulation -brick -wood -plastic -stonesection 11Material fills.
--ag-c-metal-iron -titanium -aluminium -gold -coppersection 11Named tints.
--ag-c-outline / --ag-sw-outline / Material outline (points at ink and regular).
--ag-c-particle / -outline, --ag-sw-particle, --ag-particle-r / , , Particle body, outline, outline width, radius.
--ag-c-axis / --ag-sw-axis / Axes (points at muted).
--ag-c-gridline / --ag-sw-gridline / Gridlines (points at hairline and fine).
--ag-c-inverseText on a dark fill.
--ag-translucent-opacityFill opacity of ag-translucent.
Diagram layer (agDiagrams.css)
--ag-c-ground / --ag-c-ground-border / --ag-ground-radius / / The ground. Set --ag-c-ground to transparent to drop it from every diagram at once.
Demo layer (agTeachingDemos.css)
--ag-c-control-accentSliders, readouts, meter fill.
--ag-c-control-text / -border / -surface / / Control text, borders, panel backgrounds.
--ag-c-meter-trackEmpty part of a meter.
--ag-march-speedSeconds per dash cycle (lower is faster).

17. When something looks wrong

SymptomCause and fix
A whole diagram is black shapes on white.The stylesheet is not loading. It was embedded as <img> (use <object>; the deck builder does), or the xml-stylesheet href is wrong for where the file sits.
One shape is black.It has no class. Give it the class that says what it is.
One shape ignores a restyle.It carries style=, fill= or stroke= (Inkscape). Delete the attribute.
Every metal on a page is shiny, or tints are ignored.The metal-gradient defs block is somewhere in the document; gradients resolve document-wide.
Demo labels are huge, in a serif font.The demo's wrapper is missing class="ag-demo".
A stacked class has no effect (a heavy line stays regular, a hue label stays ink).Source order in agDrawing.css: a role or text rule has ended up below the modifier it should lose to. Modifiers stay last; colour modifiers come after size classes.
A ghost box comes out blue.Not since 2026-10-09: neutrals now reset tint. If it happens, a neutral rule has lost its tint line.
Marching dashes do not move.The reduced-motion preference is on (Windows: Animation effects off). Intended.
Particles are flat, not shiny, or temperature colours are missing.The browser predates color-mix() (2023).
convert.bat warns about a diagram.It is missing from diagrams/diagrams.json, or listed but gone.

18. Old names, and where the reasoning lives

Until 2026-10-09 the diagrams and the demos had separate stylesheets with separate names. Older entries in the CLAUDE.md log use the old names; this is the mapping.

OldNow
ag-d-* (every diagram class)ag-*: ag-d-box is ag-box, ag-d-ground is ag-ground, and so on
ag-d-terracotta on heat arrowsag-heat
ag-d-fill-ink … -ghostag-solid + a neutral
ag-line-thin / -medium / -thickag-line ag-fine / ag-line / ag-line ag-heavy
ag-heat-arrow + ag-heat-arrow-headag-connector ag-heavy ag-marching + ag-arrowhead, inside ag-heat
ag-graph-labelag-label
ag-default-curve1 / 2ag-line ag-red / ag-line ag-blue
--ag-heat-arrow-speed--ag-march-speed
--ag-fs-axis-label--ag-fs-label
--ag-sw-thin / -medium / -thick--ag-sw-fine / -regular / -heavy
--ag-d-* variables--ag-c-* for colours (--ag-d-ink is --ag-c-ink), --ag-h-* for hue carriers
--ag-c-line, --ag-c-graph-label, --ag-c-curve1/2, --ag-sw-arrow, --ag-c-heat-arrowRetired: ink, ag-label with a colour modifier, hue classes, ag-heavy, ag-heat
--ag-c-meter-border--ag-c-control-border
agTeachingDemosGuide.html, agDiagramsGuide.htmlThis page

Why anything is the way it is (the motion policy, the canvas, the palettes, every bug and its fix) is recorded in the design decisions log in CLAUDE.md at the repository root. That log is the project's memory; this page is the manual.