react-nice-avatar: getConfig not working properly

when i’m using this method to generate man avatar it is also generating female avatar sometimes… is this the correct way of doing it or am i doing something wrong ? Please help me with this const config = genConfig({ sex: "man" })

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (9 by maintainers)

Most upvoted comments

sorry I don’t know what’s your problem, are u saying how do you use genConfig(‘id_string’) and specify sex and hairstyle? if so, I don’t think it is possible atm, maybe I can improve it in the future but don’t have time for the moment

I have a download feature for the demo page, for your reference https://github.com/dapi-labs/react-nice-avatar/blob/main/demo/src/App/index.tsx#L40-L55 it relies on the lib dom-to-image

I see, the hairstyle in the screenshot named normal and it is used for both man and woman. One solution would be picking a hairstyle yourself and pass it into the config, example:

const hairStyles = ["thick", "mohawk"];
const randomHairStyle = hairStyles[Math.floor(Math.random() * hairStyles.length)];
const config = genConfig({ sex: "man", hairStyle: randomHairStyle })

can you give me a snapshot if possible? might be helpful for my debug, thanks : ) I will take a check when I have time