Colouring glyphs and objects

A formula has one colour, and each of its glyphs can have a colour of its own. You set them in the Creator or straight in the Preview, and a glyph keeps its colour through every transformation.

Where a colour lives

A colour belongs to one of three things:

A glyph is named by its place in the formula. The glossary calls that place its canonical index; you meet it as the number the glyph view shows under the pointer.

The colour of a whole formula

Double-click a formula in the Creator (or select it and press Enter) to open its editor. The Colour row has a colour picker and a hex field: type a colour, such as #58C4DD, and press Enter, or leave the field.

The top of a formula's editor: name, tag, size and the Colour row, whose picker and hex field are ringed and numbered 1.
The Colour row of a formula's editor (1).

A new formula is white, as Manim draws a formula by default. With a palette active, it takes the palette's formula colour instead; Palettes tells how.

Glyph by glyph in the Creator

The right half of the editor is the glyph view. It draws every glyph of the formula inside a frame, and shows the index of the one under the pointer. A glyph you have not coloured is drawn in the colour of the formula.

  1. Click a glyph to select it. Shift+click another to take the range between them, and Ctrl+click to add or remove one. You can also drag a box over several glyphs, and Ctrl held adds them to what is selected.
  2. Click a swatch to colour the selection, or type any colour in the hex field beside the swatches.
  3. Clear selected gives the selected glyphs back the colour of the formula, and Clear colours does it for all of them.
The glyph view of y = mx + b with the m and the x selected: the drawing (1), the twelve swatches (2) and the hex field (3), and under them Select all, Clear selected and Clear colours.
The glyph view with two glyphs selected: the drawing (1), the swatches (2) and the hex field (3).
A click on the m and a Shift+click on the x select the pair, and a swatch makes it blue. Clear colours puts everything back.

The twelve swatches are Manim's own colours, WHITE to PURPLE. With a palette active, its roles follow them. A right-click on the selection offers the same colours, and Hide at the start and Show at the start for the glyphs that should wait for a transformation.

Glyph by glyph in the Preview

You can also colour glyphs where they are on the scene. Hold Alt and click a glyph to pick it; Alt+click it again to let it go. Alt+Shift+click takes a range, and Alt+drag from a formula draws a rectangle that picks the glyphs it touches. The picked glyphs light up in yellow, and a bar in the corner of the Preview names them.

The Preview with the m and the x of y = mx + b picked in yellow. In the top-left corner a bar reads '2 glyphs of step1: 2, 3' and offers Colour, Brace, Shape and a close button; the bar is ringed and numbered 1.
Two glyphs picked, and the bar that acts on them (1).

The bar's Colour ▾ menu has the same swatches. A right-click on the ink of a picked glyph opens the same actions, with the colours under Colour. Esc lets the glyphs go, and so does selecting something else.

Alt+click on the m, Alt+Shift+click on the x, Colour ▾ and a swatch. Esc lets the glyphs go, and Ctrl+Z takes the colour back.

The glyphs can be of several formulas at once: Alt+click a glyph of another formula and it joins the pick. A colour then goes to all of them as one undo step. Picking glyphs tells the rest.

The Preferences menu with Glyph selection colour open: Yellow, Orange, Magenta, Cyan, Green and White.
The colours the picked glyphs can wear.

Any colour: the Hex field

Every Colour menu has a Hex field under its swatches. Type #RRGGBB, or #RGB for a short one; the # is optional. The square beside the label shows the colour you typed, and Enter or Apply uses it. Something that is not a colour is marked, and Apply stays off.

With one glyph picked, Copy colour to clipboard puts the colour that glyph is seen in on the system clipboard, as #RRGGBB, beside the colour itself. It is the glyph's own colour, or the formula's when it has none. Paste it into another Hex field with Ctrl+V, or into any other program. When the browser does not let the page write to the clipboard, a notice shows the colour so that you can type it.

The Colour menu of the bar with one glyph picked: the swatches, the Hex field with 12ab9f typed in it (ringed, 1), Clear colour, Copy colour to clipboard with its colour #58C4DD (ringed, 2), Copy colour sequence, Paste colour sequence, and Hide and Show at the start.
A colour typed in the Hex field (1), and Copy colour to clipboard (2), which shows the colour it would copy.

A brace, a shape or a line has one colour and no glyphs to pick. The own menu of a brace or a shape has Colour ▸ with the same swatches and the same Hex field, and a line's colour is in the Line section of the Animations panel. See Braces, Shapes and Lines and arrows.

Colours in order

Two lines of a derivation often say the same thing with other symbols: the m and the b of y = mx + b become the 2 and the 1 of y = 2x + 1. Colours in order copies the colours of some glyphs, one by one, and gives them in that order to others, whatever those are.

  1. Press Shift+C. The Preview says what to do, and the top of the Animations panel shows a strip, Colours in order.
  2. Click, one by one, the glyphs whose colours you want. Each click adds a chip to the strip, in the order of your clicks, with its number and its colour. A glyph without a colour of its own adds the colour of its formula.
  3. Press Enter (or Paste…). The first chip is marked as the next to give out.
  4. Click the glyphs that take the colours. Each click colours one glyph and removes its chip. With the last colour the mode ends by itself.
Shift+C, a click on the m and one on the b, Enter, a click on the 2 and one on the 1. Ctrl+Z takes the whole paste back in one step.
The Colours in order strip while copying: two chips, 1 for the m in blue and 2 for the b in gold, and the buttons Paste… and Cancel.
Copying: a chip for each click.
The Colours in order strip while pasting: the same two chips, the first marked as the next to give out, and a Done button.
Pasting: the marked chip is next.

The result is the colouring of the next line, and it holds through the transformation between them:

A few details help:

The same two commands are in the Edit menu, and at the end of the Preview's right-click menu of a clip, as Copy colours in order… and Paste colours in order.

The Edit menu with Colours in order open: Copy… with Shift+C, and Paste with Shift+V.
Edit ▸ Colours in order.

Copying a colour sequence

When the glyphs are the same symbols in two places, a colour sequence is faster. The classic case is a formula and the sentence that explains it: colour the a, b and c of the equation, then give the same colours to the three letters of the sentence.

  1. Alt+click the glyphs of the first object. They need not be next to each other.
  2. Open Colour ▾ in the bar (or right-click a picked glyph) and choose Copy colour sequence. It takes the own colours of the picked glyphs.
  3. Press Esc, then Alt+click the glyphs of the other object, in this formula or another one.
  4. Open the menu again and choose Paste colour sequence.
The a, b and c of the equation picked in yellow, and the Colour menu of the bar open with Copy colour sequence ringed and numbered 1.
The three letters of the equation are picked: Copy colour sequence (1) takes their colours.

Each glyph takes the colour of the copied glyph that is its symbol. Of several equal symbols, the first takes the first colour, the second the second, in glyph order. A glyph loses its own colour where the copied one had none. The two picks may list their glyphs in another order, but they must be the same symbols, each as many times.

The line under Paste colour sequence says what would be pasted, or why it cannot be: Nothing copied yet., The copied sequence has 3 glyphs; this selection has 2. or The symbols differ followed by which.

The Colour menu with the three letters of the sentence picked: Paste colour sequence is on, and the line under it, ringed and numbered 1, reads '3 glyphs of equation, 3 coloured.'
The line under Paste colour sequence (1).

Colouring by pattern

To colour every x of a whole derivation without picking a glyph, give the editor a list of LaTeX patterns and their colours. That is Match colors.

What reaches Manim

Colours leave the editor as plain values. The exported scene colours each glyph of a formula by its place, as you did: the line step1_g[2].set_color("#58C4DD") below is the m of y = mx + b. The file needs no palette, no list and nothing of the editor to run.

Where to go next