Making a Recalbox theme

49 pages · 8 sections
⌕
FRENESDE Show everything Create my theme

Splitting your theme: <include>

A serious theme does not fit in a single file.

<include> loads another file at that exact spot, as if its content were copied there.

<include>${root}/views/system.xml</include>
<include path="${root}/views/detailed.xml" />

Both spellings work: the path as the tag's content, or as a path attribute.

Order matters

Two components with the same name replace each other: the last one read wins. But “the last one read” is not “the last one written” — within a file, Recalbox first processes all its includes, and only then its own views:

The views of a file always override those of the files it includes, even when the <include> is written lower down. Between two sibling includes, however, it really is the last one written that wins.

base.xml background = blue rouge.xml background = red the background is RED read top to bottom: two components with the same name replace each other, the LAST one wins that is the whole overlay mechanism — and therefore the options

That is the whole overlay mechanism — and it is how theme options are built: each choice is a file loaded on top, redefining only what changes. See What an option is.

<include>${root}/views/base.xml</include>       <!-- paints the background blue -->
<include>${root}/options/rouge.xml</include>     <!-- repaints it red -->

Including under a condition

An <include> accepts if=, like a component: the file is only loaded if the condition is true.

<include if="crt">${root}/views/system-crt.xml</include>

That is how you serve a different layout per screen, without duplicating everything else. The list of conditions is in Conditional display.