Documentation

Hard shadow

A shadow with no blur: the card's own shape, moved down and to the right.

Hard shadow: the sample page.
The sample page, drawn by UrDeck from this theme.

The theme

This is the theme.json of the recipe, exactly as it is in the repository (site/cookbook/hard-shadow/). Save it as themes/my-theme/theme.json next to UrDeck.Host.exe and set "theme": "my-theme", or copy the keys you like into your own theme.

{
  "$schema": "https://urdeck.app/schemas/v1/theme.json",
  "meta": {
    "name": "Hard shadow",
    "description": "Flat yellow cards with a black outline and a shadow that is a copy of the card.",
    "mode": "light"
  },
  "colors": {
    "background": "#f6f0e0",
    "cardFill": "#ffd84a",
    "cardBorder": "#111111",
    "text": "#111111",
    "textMuted": "#2b2b2b",
    "accent": "#111111",
    "accentDim": "#22111111"
  },
  "card": {
    "radius": 0.1,
    "borderWidth": 0.02,
    "gap": 0.11,
    "shadow": { "x": 0.05, "y": 0.05, "blur": 0, "color": "#111111" }
  },
  "indicator": {
    "active": "#111111",
    "inactive": "#55111111",
    "backdrop": "#ccf6f0e0"
  }
}

How it works

card.shadow is the card’s shape moved by x and y (fractions of a cell), grown by spread and blurred by blur. A blur of 0 is a hard edge, which is the whole trick: the shadow looks like a second, black card behind the first.

  • The shadow is drawn under all the cards of the page, so it never covers a neighbour’s content. Its reach, here 0.05 of a cell, has to stay inside card.gap (0.11), or it would run under the next card. When a card fill is translucent the deck shortens the reach to the gap and logs it once, and theme validate warns first (THEME054); an opaque fill keeps the shadow whole.
  • The border and the shadow share one colour here (#111111). card.borderWidth of 0.02 is about 5 pixels on the panel.
  • A light theme needs more than the card: the page indicator is white by default, so indicator gives it dark colours, and the colors for text, muted text and accent are dark too. Set meta.mode to light so an editor can group the theme.

Try "blur": 0.03 for a soft shadow, or a negative x for a shadow to the left. A pressed card’s shadow shrinks and dims with it.

All recipes · Theme reference