The Color class creates and converts colors for tints, fills, strokes, and anywhere PixiJS accepts a ColorSource . Most APIs accept raw hex/strings directly, so explicit new Color(...) is only needed when converting formats or manipulating values. Quick Start const fillColor = new Color ( "#ff6600" ) ; console . log ( fillColor . toHex ( ) ) ; // '#ff6600' console . log ( fillColor . toNumber ( ) ) ; // 0xff6600 console . log ( fillColor . toArray ( ) ) ; // [1, 0.4, 0, 1] const g = new Graphics ( ) . rect ( 0 , 0 , 200 , 100 ) . fill ( fillColor ) ; app . stage . addChild ( g ) ; const sprite = Sprite . from ( "hero.png" ) ; sprite . tint = "dodgerblue" ; app . stage . addChild ( sprite ) ; const t = Color . shared . setValue ( 0xffffff ) . multiply ( [ 1 , 0.5 , 0.5 ] ) . toNumber ( ) ; sprite . tint = t ;
pixijs-color
安装
npx skills add https://github.com/pixijs/pixijs-skills --skill pixijs-color