Skip to contents

The studio guide for mascot_theme(). The same page is read in the mascot studio.

Try it live. The mascot studio shows this function with live controls and the generated code. In an R session with the optional packages bslib and knitr installed, run:
mascot::mascot_studio(fn = "mascot_theme")
It opens on this function's guide; change a control and watch the mascot.

Palettes

name description source
night_teal The character's own colours, with no palette applied. native
sea_green Sea-green face, silver ring, dark navy hair and a coral bow. character
forest Forest-green face, gold ring and bow, deep pine hair. character
spring Light spring-green face, gold ring, forest hair and a pink bow. character
peach Peach face, amber ring, plum-brown hair and a red-coral bow. character
coral_navy Pale peach face, coral ring, navy hair and a teal bow. character
desert_coral Sand face, coral ring, terracotta hair and a gold bow. character
rose_soft Soft rose face, rose-gold ring, berry-brown hair and a pale gold bow. character
lilac_soft Soft lilac face, mauve ring, dusky violet hair and a pale gold bow. character
mist_navy Pale blue-grey face, steel-blue ring, navy hair and a gold bow. character
name description source
lilac_violet The character's own colours, with no palette applied. native
orchid Pink face, plum rim and deep violet hair. character
coral_navy Peach face, coral rim and dark blue hair. character
azure Pale blue face, blue rim and navy hair. character
peach_ink Peach face, rose rim and ink blue hair. character
lilac_soft Soft lilac face, mauve rim and dusky violet hair. character
mist_navy Pale blue-grey face, steel-blue rim and navy hair. character
desert_clay Sand face, cream rim and terracotta hair. character
forest Forest-green face, gold rim and deep pine hair. character
apricot_navy Apricot face, burnt-orange rim and navy hair. character
blush_plum Pale pink face, mauve rim and dark plum hair. character
lilac_dusk Soft lilac face, amber rim and deep violet hair. character
sea_green Sea-green face, silver rim and dark navy-teal hair. character
name description source
original The character's own colours, with no palette applied. native
orbit White casing, black visor and cyan lights. character
carbon Gunmetal casing, black tyre and cyan visor. character
cobalt_droid White casing with blue trim and lights. character
crimson White casing with red limbs and lights. character
name description source
original The character's own colours, with no palette applied. native
lagoon Turquoise water with a pink shell. character
glacier Pale blue water with a purple shell. character
coral_reef Green water with a coral shell. character
night_bay Deep blue water with a yellow shell and glowing cheeks. character
monsoon Rain blue water with a golden shell. character

Colour precedence: the character’s own colours, then palette, then light/dark colours, then css (later wins).

In update_mascot(), theme = "original" restores the character’s own colours; theme = NULL leaves colours as they are.

A palette without a dark version uses its light colours in both modes; this applies to all shipped palettes.

Native and built-in palette colours give no contrast warnings. Your own colours warn below 3:1 contrast in development mode and previews; the colours are kept.

Which mode applies

mode = "light" or "dark"
always wins
→
page's own switch
data-bs-theme
→
Quarto
quarto-dark
→
neither found
light

Panels and the restore button

The panels (bubble, menu, tooltip) and the restore button can also be styled with CSS: see ?mascot_styling.

Brand colours from bslib

bs_theme(primary =)
→
body
and the colours that follow it
bs_theme(secondary =)
→
rim
and the colours that follow it
bs_theme(primary =)
→
body
and the colours that follow it
bs_theme(secondary =)
→
rim
and the colours that follow it
bs_theme(primary =)
→
body
and the colours that follow it
bs_theme(secondary =)
→
copper
and the colours that follow it

Neer has no colours that bslib's primary or secondary colour changes: a bslib theme leaves it unchanged.

Experimental Which parts of a character a bslib theme colours may change in a later release; see the experimental colour mapping section of ?mascot_theme .

bs_theme(). A bs_theme() always uses mode = "auto" and cannot be combined with palette, light, dark or css.

Warnings, errors and common mistakes

mascot_theme(light = list(outline = "not-a-colour"))
Error: could not find function "mascot_theme"
mascot("helper", character = "tessa", theme = "lilac_violet")

mascot() errors and lists this character's palettes. The hint names another character that has this id; each palette belongs to its own character.

Error: could not find function "mascot"
mascot("helper", character = "tessa", theme = "zzzzzz")

mascot() errors and lists this character's palettes. No character has this id, so there is no borrowed-palette hint.

Error: could not find function "mascot"
update_mascot("helper", character = "tessa", theme = "lilac_violet", session = session)

update_mascot() warns (class mascot_update_ignored) and ignores the whole update. The mascot and its current palette stay unchanged; nothing is dropped.

Error: could not find function "update_mascot"