Skip to content

Runtime Helper Overview

Import utilities from wallpaper-engine/helpers. This entry point does not import Vite, mutate host globals, or initialize shared runtime state; bundlers can retain only the exports you use.

import {
createFpsLimiter,
toFileUrl,
wallpaperColorToHex,
} from 'wallpaper-engine/helpers';
Task Start here
Convert Color.js or CSS syntax into Wallpaper Engine’s native color string colorToWallpaperColor
Parse a host color into byte channels, CSS RGB, or hex Wallpaper color conversion
Extract an average or dominant color from images, videos, canvases, or raw pixels Average-color extraction
Normalize host filesystem paths and simulator object URLs toFileUrl
Clamp and split the 128-sample audio spectrum Audio guide
Resolve host-defined playback constants Media guide
Encode canvas RGB bytes for LED or iCUE APIs LED canvas encoding
Apply Wallpaper Engine’s FPS limit and pause/resume behavior Frame limiting
  • The helpers entry is side-effect-free and independently tree-shakeable.
  • Browser-specific helpers accept native DOM objects but do not register Wallpaper Engine listeners for you.
  • clampAudio(), leftChannel(), and rightChannel() allocate new arrays. Color result and URL/string behavior is documented per API; getColorFromArray4() may return the supplied defaultColor tuple for undersized input.
  • Import build-time builders and Vite integration from wallpaper-engine/plugin, not this entry.
  • Import host contracts and ambient global declarations from wallpaper-engine.

See the exact Helpers API Reference and public source in src/helpers.ts.

Use Colors & Media for conversion and extraction, or Files, LED & Frames for browser path, hardware, and render-loop tasks.