function generateMedia(media, mode) {
  assert.ok(
    media &&
      media.type === 'media' &&
      'media' in media &&
      'rules' in media &&
      media.media === '(prefers-color-scheme: ' + mode + ')' &&
      media.rules,
    'expected `' + mode + '` head'
  )
  const rule = media.rules[0]
  assert.ok(
    rule && 'declarations' in rule && rule.declarations,
    'expected `' + mode + '` rule'
  )

  return css.stringify({
    type: 'stylesheet',
    stylesheet: {
      rules: [
        {
          type: 'rule',
          selectors: [':root'],
          declarations: rule.declarations.filter(function (d) {
            return (
              'property' in d &&
              d.property &&
              d.property.startsWith('--color-prettylights-')
            )
          })
        }
      ]
    }
  })
}
@param {Node | undefined} media
  Media node.
@param {'dark' | 'light'} mode
  Mode.
@returns {string}
  CSS.