GithubHelp home page GithubHelp logo

leviwangjs / avatar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matthewcallis/avatar

0.0 2.0 0.0 359 KB

JavaScript library for showing Gravatars or generating user avatars.

Home Page: http://matthewcallis.github.io/avatar/

License: MIT License

JavaScript 88.39% HTML 5.71% CSS 5.91%

avatar's Introduction

Build Status Dependency Status devDependency Status Test Coverage Coverage Status bitHound Overall Score npm version npm downloads

Avatar is a JavaScript library for showing Gravatars or generating user avatars.

Examples

There are several examples on the website.

var avatar = new Avatar(document.getElementById('avatar'), {
  'useGravatar': false,
  'initials': 'MC'
});

/* or */

$('#avatar').avatar({
  'useGravatar': false,
  'initials': 'MC'
});

This example will render an avatar with my initials "MC" as the image.

Avatar Example

Options

Avatar is highly customizable and most options are self explanatory:

useGravatar: true # Allow Gravatars or not.
fallbackImage: '' # URL or Data URI used when no initials are provided and not using Gravatars.
size: 80          # Size in pixels, fallback for hidden images and Gravatar

# Initial Avatars Specific
initials: ''  # Initials to be used.
initial_fg: '#888888' # Text Color
initial_bg: '#f4f6f7' # Background Color
initial_size: null    # Text Size in pixels
initial_weight: 100
initial_font_family: "'Lato', 'Lato-Regular', 'Helvetica Neue'"

# Gravatar Specific
hash: null  # Precalculated MD5 string of an email address
email: null # Email used for the Gravatar
fallback: 'mm'               # Fallback Type
rating: 'x'                  # Gravatar Rating
forcedefault: false          # Force Gravatar Defaults
allowGravatarFallback: false # Use Gravatars fallback, not fallbackImage

# GitHub Specific
github_id: null  # GitHub User ID.

# Avatars.io Specific
use_avatars_io: false # Enable Avatars.io Support
avatars_io:
  user_id: null       # Avatars.io User ID
  identifier: null    # Avatars.io Avatar Identifier
  twitter: null       # Twitter ID or Username
  facebook: null      # Facebook ID or Username
  instagram: null     # Instagram ID or Username
  size: 'medium'      # Size: small, medium, large

Installation

<script src="md5.js"></script>
<script src="avatar.js"></script>

Avatar expects a window.md5() function to be defined in order to generate the hashes needed for Gravatar. One is provided as a seperate file if you would like to use your own or don't plan on using Gravatar.

Running Tests

To execute all unit tests, open test/index.html in your target browser.

Browser Support

These are the browsers I have tested on personally:

v1.2.0

  • OS X 10.10.2 - Chrome 41.0.2243.2 dev (64-bit)
  • OS X 10.10.2 - Firefox 34.0
  • OS X 10.10.2 - Safari 8.0.3 (10600.3.10.2)
  • iOS 8.1.2 - Safari 8
  • iOS 8.1.2 - Chrome 39
  • Microsoft Remote Desktop - Internet Explorer 11 (11.0.9879.0)

v1.3.0

  • OS X 10.10.2 - Chrome 48.0.2541.0 dev (64-bit)
  • OS X 10.10.2 - Firefox 41.0.2
  • OS X 10.10.2 - Safari 9.0 (11601.1.56)

Thanks

Pretty styles and design support kindly provided by Andrew Crocker. Built with love at Apptentive.

Package Managers

There are a lot of these and keeping up with them is hard, so here's a list:

Releasing

  • npm - npm-bump major/minor/patch
  • bower - bower info avatar

License

Avatar is MIT licensed.

avatar's People

Contributors

matthewcallis avatar

Watchers

 avatar  avatar

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.