npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

svg_avatar_angularjs

v1.3.4

Published

angular module for svg_avatar

Downloads

4

Readme

SvgAvatarAngularJs

by Gabriel Franck

SvgAvatarAngularJs is an AngularJS module based on SvgAvatar allow us to use svgAvatar methods and add some directives.

Link to npm

Link to gitHub

Demo

No demo for now (coming soon). Here is a link to the svgAvatar live demo.

Installation

Install it via npm :

npm install svg_avatar_angularjs

Include the svg_avatar_angularjs.js in your index.html :

<script src="node_modules/svg_avatar_angularjs/svg_avatar_angularjs.js"></script>

and then include it to your app :

app = angular.module('myApp',['svgAvatarAngularjs'])

Usage

Directives

svgAvatar

The svgAvatar directive allow us to easily display an avatar.

Syntax
<svg-avatar avatar-id="avatar_id" avatar="avatar_svg" avatar-width="50" avatar-height="50"></svg-avatar>

|Parameters| value | description| |---|---|---| |avatar-id | String | id for the svg element of the avatar to use getElementById(avatar_id) | |avatar | String (Svg code) | svg code of the avatar | |avatar-width | Int | width of the avatar | |avatar-height | Int | height of the avatar |

Methods

Before using methods you need to require the svgAvatarService in your controller, service ... :

app.controller('myController', function(svgAvatarService){
	// Your controller code
})

lib_json()

Return the content of the current avatar_lib.json (wich contains all svg parts of the avatar) in a JSON object

Syntax
svgAvatarService.lib_json() //-> JSON object (content of avatar_lib.json by default)

stringify_avatar()

Return the value of an avatar converted to string, could be useful to store avatars into a database

Syntax
svgAvatarService.stringify_avatar(avatar_json) //-> String (avatar)

|Parameters| value | description| |---|---|---| |avatar_json | JSON Object | the avatar value in json |


render_svg()

Return an avatar svg value in string

Syntax
svgAvatarService.render_svg(avatar) //-> SVG String (avatar_svg)

|Parameters| value | description| |---|---|---| |avatar | Object or String | the avatar value in json or in string |


random_avatar()

Generate a random avatar object or Svg string

Syntax
svgAvatarService.random_avatar() //-> Object (avatar)
svgAvatarService.render_random_svg() //-> SVG String (avatar_svg)

modify_avatar()

Return an avatar object or Svg string with a color or pattern changed, you can choose the direction "next" to increment or "previous" to decrement (it loops when max/min value is reached)

Syntax
svgAvatarService.modify_avatar(avatar, part, change, direction) //-> Object (avatar)
svgAvatarService.modify_avatar_svg(avatar, part, change, direction) //-> Object (avatar)

|Parameters| value | description| |---|---|---| |avatar | Object or String | the avatar value in json or in string | |part|"form","eye","mouth" by default| the part selected | |change|"pattern" or "color"| the modification to do | |direction|"next" or "previous"| the direction to increment or decrement |


next / previous for color / pattern methods

Return an avatar object or Svg string with a color or pattern changed, you can choose the direction "next" to increment or "previous" to decrement (it loops when max/min value is reached)

Syntax
svgAvatarService.next_color_avatar(avatar, part) //-> Object (avatar)
svgAvatarService.previous_color_avatar(avatar, part) //-> Object (avatar)

svgAvatarService.next_color_svg(avatar, part) //-> SVG String (avatar_svg)
svgAvatarService.previous_color_svg(avatar, part) //-> SVG String (avatar_svg)

svgAvatarService.next_pattern_avatar(avatar, part) //-> Object (avatar)
svgAvatarService.previous_pattern_avatar(avatar, part) //-> Object (avatar)

svgAvatarService.next_pattern_svg(avatar, part) //-> SVG String (avatar_svg)
svgAvatarService.previous_pattern_svg(avatar, part) //-> SVG String (avatar_svg)

|Parameters| value | description| |---|---|---| |avatar | Object or String | the avatar value in json or in string | |part|"form","eye","mouth" by default| the part to increment or decrement |

Tests

There's no test for now.

Build / Contribute

In order to make svgAvatarAngularsvg working with SvgAvatar you need to put the content of svgAvatar/bundle.js at the beginning of the code of svgAvatarAngularjs/svg_avatar_angularjs.js. Look at this if you want to make a new bundle.js