Giter Site home page Giter Site logo

dmester / jdenticon-net Goto Github PK

View Code? Open in Web Editor NEW
80.0 4.0 12.0 10.24 MB

.NET library for generating identicons. Running on .NET Core and other .NET Standard compatible platforms.

Home Page: https://jdenticon.com

License: MIT License

C# 99.79% HTML 0.21%
identicon avatar jdenticon dotnet dotnet-core dotnet-standard dotnet-framework aspnet-mvc aspnetcore wpf winforms

jdenticon-net's Introduction

.NET library for generating highly recognizable identicons.

Sample identicons

Build Status Downloads License MIT

Features

Jdenticon-net is a .NET port of the JavaScript library Jdenticon.

  • Runs on multiple .NET platforms.
    • .NET Framework 2.0 and later
    • .NET Standard 1.0 and later
    • .NET Core 1.0 and later
  • Render icons as PNG and SVG files with no dependencies to System.Drawing or WPF.
  • Integration package available for ASP.NET Core, ASP.NET WebForms, MVC and WebApi.
  • Generate SVG fragments to be used inline on websites.
  • Controls available for WPF and WinForms.

Getting started

ASP.NET

Desktop

General usage

Quick Reference

For full documentation, please see https://jdenticon.com/net-api/.

Create an instance of Identicon

There are mainly two ways of creating an instance of Identicon:

  • Identicon.FromHash(hash, size)

    Creates an instance with a hash value. You can either provide a byte array containing the hash, or provide a hexadecimal hash string. At least 6 bytes are required in byte arrays and 12 characters in hash strings.

  • Identicon.FromValue(value, size[, hashAlgorithmName])

    Jdenticon-net will create a hash for you using the specified hash algorithm. You can provide any object, even null, as argument. Jdenticon will use ToString to get a string representation of the object and then push the UTF8-encoded string through the specified hash algorithm. If no hash algorithm is specified Jdenticon-net will default to SHA1.

Generate an icon

There are multiple methods in the Identicon class for generating icons:

  • SaveAsPng(path|stream)

    Generates an icon and saves it as a PNG image.

  • SaveAsSvg(path|stream|TextWriter)

    Generates an icon and saves it as an SVG image.

  • ToSvg([fragment])

    Generates an SVG string containing an icon. This can be useful for embedding icons in other SVG files or inlining SVG icons on your website. For creating SVG files, please use Save.

Change icon appearance

You can customize the colors of the generated icons, by using IdenticonStyle. The easiest way of creating a new style is to use the icon designer.

Advanced customizations

By subclassing Jdenticon.IconGenerator you can completely override the look of your icons. Set the Identicon.IconGenerator property to an instance of your own generator to make use of the customized icon generator.

License

Jdenticon-net is released under the MIT license.

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.