In kaboom.d.ts, the type for KaboomOpt.background is number[] | string
/**
* Kaboom configurations.
*/
export interface KaboomOpt<T extends PluginList<any> = any> {
...
/**
* Background color. E.g. [ 0, 0, 255 ] for solid blue background, or [ 0, 0, 0, 0 ] for transparent background.
*/
background?: number[] | string,
...
However, when passing an string (e.g. white) as the value, an error will be thrown
Cannot read properties of null (reading '1')
TypeError: Cannot read properties of null (reading '1')
at Color.fromHex (http://localhost:3000/static/js/bundle.js:90943:30)
at rgb (http://localhost:3000/static/js/bundle.js:91025:43)
at http://localhost:3000/static/js/bundle.js:92977:28
at default (http://localhost:3000/static/js/bundle.js:93006:7)
at createKaboom (http://localhost:3000/static/js/bundle.js:1490:57)
at http://localhost:3000/static/js/bundle.js:156:58
In
kaboom.d.ts
, the type forKaboomOpt.background
isnumber[] | string
However, when passing an string (e.g.
white
) as the value, an error will be thrownversion:
3000.1.17