Skip to content

Instantly share code, notes, and snippets.

@deusmachinea
Created November 28, 2021 19:28
Show Gist options
  • Select an option

  • Save deusmachinea/6f2012efb5d4fb981d75ce829931b8f4 to your computer and use it in GitHub Desktop.

Select an option

Save deusmachinea/6f2012efb5d4fb981d75ce829931b8f4 to your computer and use it in GitHub Desktop.

Revisions

  1. deusmachinea created this gist Nov 28, 2021.
    21 changes: 21 additions & 0 deletions avataar.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    from py_avataaars import PyAvataaar

    def generate_mock_user_details(path, name):
    avatar = pa.PyAvataaar(
    style=pa.AvatarStyle.TRANSPARENT,
    skin_color=pa.SkinColor[random.choice([i.name for i in pa.SkinColor])],
    hair_color=pa.HairColor[random.choice([i.name for i in pa.HairColor])],
    facial_hair_type=pa.FacialHairType[random.choice([i.name for i in pa.FacialHairType])],
    facial_hair_color=pa.HairColor[random.choice([i.name for i in pa.HairColor])],
    top_type=pa.TopType[random.choice([i.name for i in pa.TopType])],
    hat_color=pa.Color[random.choice([i.name for i in pa.Color])],
    mouth_type=pa.MouthType[random.choice([i.name for i in pa.MouthType])],
    eye_type=pa.EyesType[random.choice([i.name for i in pa.EyesType])],
    eyebrow_type=pa.EyebrowType[random.choice([i.name for i in pa.EyebrowType])],
    nose_type=pa.NoseType[random.choice([i.name for i in pa.NoseType])],
    accessories_type=pa.AccessoriesType[random.choice([i.name for i in pa.AccessoriesType])],
    clothe_type=pa.ClotheType[random.choice([i.name for i in pa.ClotheType])],
    clothe_color=pa.Color[random.choice([i.name for i in pa.Color])],
    clothe_graphic_type=pa.ClotheGraphicType[random.choice([i.name for i in pa.ClotheGraphicType])],
    )
    avatar.render_png_file(f'{path}/{name}.png')