How to use the @dicebear/avatars/lib/color function in @dicebear/avatars

To help you get started, we’ve selected a few @dicebear/avatars examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DiceBear / avatars / packages / avatars-bottts-sprites / src / index.ts View on Github external
return function(random: Random) {
    let primaryColorCollection = random.pickone(colorsCollection);
    let secondaryColorCollection = random.pickone(colorsCollection);

    let primaryColor = new Color(primaryColorCollection[options.primaryColorLevel]);
    let secondaryColor = new Color(primaryColorCollection[options.secondaryColorLevel]);

    if (options.colorful) {
      secondaryColor = new Color(secondaryColorCollection[options.secondaryColorLevel]);
    }

    let eyes = random.pickone(eyesCollection);
    let face = random.pickone(faceCollection);
    let mouth = random.pickone(mouthCollection);
    let sides = random.pickone(sidesCollection);
    let texture = random.pickone(textureCollection);
    let top = random.pickone(topCollection);

    // prettier-ignore
    return [
      '<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 180 180">',
      group(random, sides(secondaryColor), options.sidesChance, 0, 66),</svg>
github DiceBear / avatars / packages / avatars-bottts-sprites / src / index.ts View on Github external
return function(random: Random) {
    let primaryColorCollection = random.pickone(colorsCollection);
    let secondaryColorCollection = random.pickone(colorsCollection);

    let primaryColor = new Color(primaryColorCollection[options.primaryColorLevel]);
    let secondaryColor = new Color(primaryColorCollection[options.secondaryColorLevel]);

    if (options.colorful) {
      secondaryColor = new Color(secondaryColorCollection[options.secondaryColorLevel]);
    }

    let eyes = random.pickone(eyesCollection);
    let face = random.pickone(faceCollection);
    let mouth = random.pickone(mouthCollection);
    let sides = random.pickone(sidesCollection);
    let texture = random.pickone(textureCollection);
    let top = random.pickone(topCollection);

    // prettier-ignore
    return [
      '<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 180 180">',</svg>
github DiceBear / avatars / packages / avatars-bottts-sprites / src / index.ts View on Github external
return function(random: Random) {
    let primaryColorCollection = random.pickone(colorsCollection);
    let secondaryColorCollection = random.pickone(colorsCollection);

    let primaryColor = new Color(primaryColorCollection[options.primaryColorLevel]);
    let secondaryColor = new Color(primaryColorCollection[options.secondaryColorLevel]);

    if (options.colorful) {
      secondaryColor = new Color(secondaryColorCollection[options.secondaryColorLevel]);
    }

    let eyes = random.pickone(eyesCollection);
    let face = random.pickone(faceCollection);
    let mouth = random.pickone(mouthCollection);
    let sides = random.pickone(sidesCollection);
    let texture = random.pickone(textureCollection);
    let top = random.pickone(topCollection);

    // prettier-ignore
    return [
      '<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 180 180">',
      group(random, sides(secondaryColor), options.sidesChance, 0, 66),
      group(random, top(secondaryColor), options.topChange, 41, 0),
      group(random, face(primaryColor, random.bool(options.textureChance) ? texture() : undefined), 100, 25, 44),
      group(random, mouth(), options.mouthChance, 52, 124),</svg>

@dicebear/avatars

An avatar library for designers and developers.

MIT
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis