hubcap media

Emulate CSS media features such as color scheme, reduced motion, and forced colors.

When to use

Emulate CSS media features like dark mode, reduced motion, or forced colors to test responsive design without changing OS settings. At least one flag is required per invocation. Use emulate for full device emulation including viewport, user agent, and touch support.

Usage

hubcap media [flags]

Arguments

None.

Flags

FlagTypeDefaultDescription
--color-schemestring""Set prefers-color-scheme: light or dark
--reduced-motionstring""Set prefers-reduced-motion: reduce or no-preference
--forced-colorsstring""Set forced-colors: active or none

Output

FieldTypeDescription
colorSchemestringThe applied color scheme value
reducedMotionstringThe applied reduced motion value
forcedColorsstringThe applied forced colors value

Only fields for the flags you specify appear in the output.

{"colorScheme":"dark"}

Errors

ConditionExit codeStderr
No flag specified1usage: hubcap media [--color-scheme <light\|dark>] [--reduced-motion <reduce\|no-preference>] [--forced-colors <active\|none>]
Chrome not connected2error: connecting to Chrome: ...
Timeout3error: timeout

Examples

Enable dark mode:

hubcap media --color-scheme dark

Enable reduced motion:

hubcap media --reduced-motion reduce

Combine multiple features:

hubcap media --color-scheme dark --reduced-motion reduce --forced-colors active

Switch to dark mode and take a screenshot to compare themes:

hubcap media --color-scheme dark && hubcap screenshot dark-mode.png

See also

  • emulate - Emulate a full device profile including viewport and touch
  • viewport - Set viewport dimensions
  • screenshot - Capture a screenshot of the page