You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{randpix,RandpixColorScheme,Symmetry}from'randpix'constgenerate=randpix({colorScheme: RandpixColorScheme.DARKULA,// Color theme (default: NEUTRAL)size: 8,// Art size. Recommended 7 or 8 (odd/even symmetry) (default: 8)scale: 32,// Pixel scale (default: 1)symmetry: Symmetry.VERTICAL,// Symmetry (default: VERTICAL)color: [255,100,50],// [R, G, B] like color for solid art (default: undefined),seed: 'Some string',// Seed (default: undefined)colorBias: 15,// Slightly changes the color hue, which adds more color to the image (default: undefined)grayscaleBias: false// Change only the brightness of the color instead of the hue (default: undefined)})constart=generate()// Generating the pixel artconstpngBuffer=art.toBuffer('image/png')constdataURL=art.toDataURL()
Custom color scheme
constcustomColorScheme=[// [R, G, B, C], C is the frequency of this color appearing in the pixel art[151,219,174,1],[195,229,174,0.5],[241,225,166,0.5],[244,187,187,0.2],]
My Benchmarks
With defaults: 0.11812 ms/art. Speed: 8465 arts/s
With scale 32: 0.14147 ms/art. Speed: 7068 arts/s
With bias 15: 0.11686 ms/art. Speed: 8557 arts/s
With full fill: 0.21214 ms/art. Speed: 4713 arts/s
With quarter fill: 0.06061 ms/art. Speed: 16497 arts/s
With quad symmetry: 0.11023 ms/art. Speed: 9072 arts/s
With solid color: 0.10263 ms/art. Speed: 9744 arts/s
Every instanced: 0.15031 ms/art. Speed: 6652 arts/s