Giter VIP home page Giter VIP logo

animal-avatar-generator's Introduction

Animal Avatar Generator

Generate SVG avatars on client side from a string seed. As long as the same version of the library is used it always returns the same avatar for the corresponding seed.

Live example

Install

Using npm:

$ npm install animal-avatar-generator --save

or using yarn:

$ yarn add animal-avatar-generator

Usage

import avatar from 'animal-avatar-generator'

const svg = avatar('your custom seed', { size: 200 })
document.getElementById('avatar').innerHTML = svg

Configuration options

Name Type Description Default
size number or string Avatar size in pixels or css property 150 or '75%'
round boolean Use round or rectangle shape true
blackout boolean Use blackout for right side of an avatar true
avatarColors string[] Palette for avatar colors ['#d7b89c', '#b18272','#ec8a90','#a1Ac88','#99c9bd','#50c8c6']
backgroundColors string[] Palette for background colors ['#fcf7d1', '#ece2e1','#e4e3cd','#c4ddd6','#b5f4bc']

Missing a configuration? Raise an issue.

License

MIT

animal-avatar-generator's People

Contributors

roma-lukashik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

animal-avatar-generator's Issues

Typescript error occurs when building project

Typescript error occurs when building project:

ERROR in ../common/temp/node_modules/.pnpm/${path}[email protected]/node_modules/animal-avatar-generator/dist/index.js 1:0-37
Module not found: Error: Can't resolve './utils/array' in '/${path}/node_modules/.pnpm/[email protected]/node_modules/animal-avatar-generator/dist'
Did you mean 'array.js'?
BREAKING CHANGE: The request './utils/array' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ../packages/base-components/build/dist/components/UserAvatar/UserAvatar.js 29:48-82
@ ../packages/base-components/build/dist/components/UserAvatar/index.js 13:13-36
@ ../packages/base-components/build/dist/components/index.js 80:13-36
@ ../packages/base-components/build/dist/index.js 17:13-36
@ ../packages/externals-init/build/dist/index.js 41:37-68
@ ./src/index.js 1:0-59 4:1-21

ERROR in ../common/temp/node_modules/.pnpm/${path}[email protected]/node_modules/animal-avatar-generator/dist/index.js 2:0-74
Module not found: Error: Can't resolve './utils/svg' in '/${path}/node_modules/.pnpm/[email protected]/node_modules/animal-avatar-generator/dist'
Did you mean 'svg.js'?
BREAKING CHANGE: The request './utils/svg' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ../packages/base-components/build/dist/components/UserAvatar/UserAvatar.js 29:48-82
@ ../packages/base-components/build/dist/components/UserAvatar/index.js 13:13-36
@ ../packages/base-components/build/dist/components/index.js 80:13-36
@ ../packages/base-components/build/dist/index.js 17:13-36
@ ../packages/externals-init/build/dist/index.js 41:37-68
@ ./src/index.js 1:0-59 4:1-21

ERROR in ../common/temp/node_modules/.pnpm/${path}[email protected]/node_modules/animal-avatar-generator/dist/index.js 3:0-44
Module not found: Error: Can't resolve './utils/random' in '/${path}/node_modules/.pnpm/[email protected]/node_modules/animal-avatar-generator/dist'
Did you mean 'random.js'?
BREAKING CHANGE: The request './utils/random' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ../packages/base-components/build/dist/components/UserAvatar/UserAvatar.js 29:48-82
@ ../packages/base-components/build/dist/components/UserAvatar/index.js 13:13-36
@ ../packages/base-components/build/dist/components/index.js 80:13-36
@ ../packages/base-components/build/dist/index.js 17:13-36
@ ../packages/externals-init/build/dist/index.js 41:37-68
@ ./src/index.js 1:0-59 4:1-21

ERROR in ../common/temp/node_modules/.pnpm/${path}[email protected]/node_modules/animal-avatar-generator/dist/index.js 4:0-81
Module not found: Error: Can't resolve './palette' in '/${path}/node_modules/.pnpm/[email protected]/node_modules/animal-avatar-generator/dist'
Did you mean 'index.js'?
BREAKING CHANGE: The request './palette' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ../packages/base-components/build/dist/components/UserAvatar/UserAvatar.js 29:48-82
@ ../packages/base-components/build/dist/components/UserAvatar/index.js 13:13-36
@ ../packages/base-components/build/dist/components/index.js 80:13-36
@ ../packages/base-components/build/dist/index.js 17:13-36
@ ../packages/externals-init/build/dist/index.js 41:37-68
@ ./src/index.js 1:0-59 4:1-21

ERROR in ../common/temp/node_modules/.pnpm/${path}[email protected]/node_modules/animal-avatar-generator/dist/index.js 5:0-90
Module not found: Error: Can't resolve './shapes' in '/${path}/node_modules/.pnpm/[email protected]/node_modules/animal-avatar-generator/dist'
Did you mean 'index.js'?
BREAKING CHANGE: The request './shapes' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ../packages/base-components/build/dist/components/UserAvatar/UserAvatar.js 29:48-82
@ ../packages/base-components/build/dist/components/UserAvatar/index.js 13:13-36
@ ../packages/base-components/build/dist/components/index.js 80:13-36
@ ../packages/base-components/build/dist/index.js 17:13-36
@ ../packages/externals-init/build/dist/index.js 41:37-68
@ ./src/index.js 1:0-59 4:1-21

5 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.21.2 compiled with 5 errors in 54167 ms

malformed muzzles

hi,

i'm using 1.0.4 which ostensibly has the fix for #2 in it ... but the fix isn't there.

this is what's in my node_modules directory (see line 25 in muzzles.js):

Screen Shot 2022-02-18 at 12 38 33

cheers

Use css style for the svg size property

I needed to be able to easily match the svg size to my parent element height

So I made a Pull request to solve this : #8

please feel free to merge if that's ok for you

SVG syntax error in muzzles.js

In shapes/muzzles.js there's a svg syntax error in line 25:

<path  fill="#15212a"d="M272.4 275c0-6.4-10.1-11.6-22.5-11.6s-22.5 5.2-22.5 11.5c0 2 1.1 4 3 5.7 1 .8 2 1.7 3.2 2.4l8.7 5.8a13.5 13.5 0 0015.2 0l9.7-6.6 1-.7c2.7-1.9 4.2-4.1 4.2-6.6z"/>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.