uas

ui-avatar-svg

Generate SVG avatars with user initials in pure JS

Showing:

Popularity

Downloads/wk

93

Maintenance

No Maintenance Data Available

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

Yes?

Readme

UI Avatar SVG

Generate SVG avatars with user initials in pure JS.

Usage

Generate avatars using a flexible API:

const UIAvatarSvg = require('ui-avatar-svg');

const svg = (new UIAvatarSvg())
    .text('AB')
    .size(64)
    .bgColor('#ff0000')
    .textColor('#ffffff')
    .generate();

The generate() function returns a string <svg...> that can be embedded in your app.

API

  • text(string) - User initials (default AB)
  • round(boolean) - Is the avatar round instead of square (default true)
  • size(integer) - Avatar size in px (default 64)
  • bgColor(string) - Background color (default #ff0000)
  • textColor(string) - Text color (default #ffffff)
  • fontSize(float) - Font size on a scale from 0.1 - 1.0 (default 0.4)
  • fontWeight(string|integer) - Font weight (default normal)
  • fontFamily(string) - Font family (default -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', Sans', 'Droid Sans', 'Helvetica Neue', sans-serif)

Credits

UI Avatar SVG was created by Gilbert Pellegrom from Dev7studios. Released under the MIT license.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Tutorials

No tutorials found
Add a tutorial