Reference · Draw a bracket, a table or a road to the final
resolveBackgroundfunction
Reads the background option for a drawing width by height in the look theme, with prefix for the ids. Returns null when the option is true, false or left out
(a plain colour, or none). An unknown preset, a bad colour list or an image address that is not http(s), relative or data:image/… throws a RangeError.
Import it
import { resolveBackground } from "@johnmorrisdotca/taisen-brackets";
Definition
function resolveBackground(option: unknown, theme: ThemeName, width: number, height: number, prefix: string): ResolvedBackground | null
Parameters
| Name | Type | Description |
|---|---|---|
option | unknown | The |
theme | ThemeName | The theme the drawing is in. |
width | number | The drawing's width. |
height | number | The drawing's height. |
prefix | string | The prefix of the drawing's ids. |
Returns
ResolvedBackground | null
The background; null when the option asks for none.
Examples
import { resolveBackground } from "@johnmorrisdotca/taisen-brackets";
console.log(resolveBackground(false, "light", 400, 300, "tb"), resolveBackground("ice", "light", 400, 300, "tb") !== null);null trueWhat it prints (run when this page was built)