Color & Effects

Shadows

A shadow tells the eye what sits on what. Nox has two kinds, drop shadows outside a thing and inner shadows inside it, and a node can have as many of each as it needs. The difference between a shadow that looks pasted on and one that looks real is almost always layering, softness and a little color.

A drop shadow, an inner shadow, and both together on one shape
A drop shadow, an inner shadow, and both together on one shape

Drop and inner shadows#

A shadow has an offset (x, y), a blur, a spread (grows or shrinks the shadow's shape before it is blurred) and a color, whose alpha is the shadow's strength.

  • A drop shadow lies behind and outside the thing: a card on a page, a button off its ground.
  • An inner shadow lies inside the edge: a field pressed into its panel, a well, a toggle's track. A white inner shadow 1 unit down, with no blur, is a lit top edge.

A shadow follows the shape of what casts it: the rounded corners of a card, the outline of a path, the letters of a text.

By hand
  1. Select the thing. In the inspector's Effects section, click +. Nox adds a drop shadow and opens its fields.
  2. Choose Drop shadow or Inner shadow from Kind, then set X, Y, Blur and Spread.
  3. Click the swatch to change the shadow's color, and type its opacity beside the hex value.
  4. A shut row shows its numbers in short, as 0 8 24 · 40%. Click a row to open or shut it; the eye hides a shadow, the minus removes it.
The Effects section: a drop shadow open, an inner shadow shut
The Effects section: a drop shadow open, an inner shadow shut

Layer two or three#

One shadow with a large blur looks like a smudge. Real shadows have a dark, tight part where the thing nearly touches the ground and a wide, faint part further out. Two or three drop shadows give you both.

One shadow, two and three, on the same card
One shadow, two and three, on the same card
LayersValues (x y blur · color)For
One0 12 24 · #0B0D1240Quick, and heavier than it should be
Two0 1 2 · #0B0D1224, 0 12 32 · #0B0D1224Most cards and popovers
Three0 1 2 · #0B0D121F, 0 6 12 · #0B0D1217, 0 24 48 · #0B0D121FA large card or a hero panel

Use a near-black with a hint of blue, such as #0B0D12, rather than pure black: it sits better on light and tinted grounds.

With an agent
Give the balance card a soft, three-layer shadow: a tight contact shadow, a middle one and a wide, faint one.

The agent calls update_nodes with the card's effects:

{
  "changes": [{
    "id": "5:2",
    "effects": [
      {"type": "drop_shadow", "x": 0, "y": 1, "blur": 2, "color": "#0B0D121F"},
      {"type": "drop_shadow", "x": 0, "y": 6, "blur": 12, "color": "#0B0D1217"},
      {"type": "drop_shadow", "x": 0, "y": 24, "blur": 48, "color": "#0B0D121F"}
    ]
  }]
}

effects replaces the node's whole list. For a single drop shadow there is a shorter form, "shadow": {"y": 8, "blur": 24, "color": "#0B0D1233"}, which also replaces the list.

Colored shadows#

Under a saturated button a gray shadow looks dirty. Use the button's own color at 40–50% instead, with the same offset and blur. The button seems to glow faintly onto the page, and each button of a set keeps its own character.

A black shadow under a violet button, then violet, red and green buttons each with a shadow of its own color
A black shadow under a violet button, then violet, red and green buttons each with a shadow of its own color
{"type": "drop_shadow", "x": 0, "y": 10, "blur": 24, "spread": -4, "color": "#FF5C6C73"}

A spread of −4 pulls the shadow in from the sides so it shows mostly below, as light from above would cast it.

On dark grounds#

On a dark background a shadow has little to darken. Make it stronger (black at 50% and a larger blur), then add what really shows height in the dark: a lit top edge. An inner shadow 0 1 0 in white at 18%, and a 1 unit stroke inside in white at 8%, read as light catching the rim.

A dark card with a shadow alone, and with a lit top edge added
A dark card with a shadow alone, and with a lit top edge added

When to use Lighting & Depth instead#

Lighting & Depth builds a five-layer shadow and a lit edge from one number, follows one light across a screen, and is written as CSS and SwiftUI from the same numbers. Use it for anything that should look raised: cards, buttons, menus, sheets. It keeps every height in a design consistent, and changing one variable relights the lot.

Make shadows by hand when you need what depth does not do:

  • inner shadows: pressed controls, wells, fields;
  • a colored glow with an offset of your own;
  • a shadow under a text or an icon, which follows the letters or the outline.
Note

Keep shadows in an effect style when the same set is used in many places: the inspector's Effects has a style button beside its +, and an agent uses effect_style. Change the style once and every node that uses it follows. See Styles.