Colors
Name your app's colors once, with a light and a dark version, and use them in any color setting.
Color assets are your app's own named colors, like brand or card. Each has a version for light mode and one for dark mode. Pick one in any color setting, and every view using it changes when you change the color, and switches between the two versions with the appearance.
#Find them
Open the Assets tab in the left panel (or press ⌘4). Colors is the second section. Each color is a row: its name, then a Light and a Dark swatch.
A new app starts with one color, brand.
#Add a color
- Under Colors, tap Add color.
- A new row appears, named brand (or brand2, brand3… if that's taken), in PadCode's blue, a little lighter for dark mode.
- Tap the Light swatch and pick the color for light mode, then the Dark swatch for dark mode.
- Tap the name and type a better one, like card. Press Return, or tap elsewhere, to apply it.
#Name a color
A color's name follows the same rule as a variable's: start with a letter, then use letters, numbers or _, like cardBackground. Up to 40 characters.
If the name breaks the rule, the field says what's wrong. A name that breaks the rule, or that another color already has, isn't applied: the old name comes back. Renaming a color updates every view that uses it.
#Use a color
Every color setting in the Inspector (a Text's Color, a view's Background, a shape's Fill and so on) has a color menu. Your color assets are at the top, under Asset Colors. Pick one, and the setting shows its name.
Which version shows depends on the appearance: the screen's Appearance setting, or, when that's Auto, the iPad's light or dark mode. On the canvas, the toolbar's appearance button switches between the two, so you can check both.
#Delete a color
Long-press a color's row and choose Delete Color. Undo brings it back.