Skip to content

atomfrede/jadenticon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

08fc4a2 · Mar 20, 2024
Dec 23, 2023
Feb 7, 2024
Oct 18, 2022
Feb 24, 2016
Aug 8, 2017
Feb 24, 2016
Feb 24, 2016
Apr 9, 2023
Feb 24, 2016
Mar 20, 2024
Feb 24, 2016
Oct 20, 2023
Feb 7, 2024
Jan 13, 2022
Jan 13, 2022

Repository files navigation

Build Status Latest Release Codecov branch

Jadenticon

Jadenticon is a simple java wrapper for the Jdenticon javascript library to create nice looking, random identicons.

Get It

Jadenticon is available on Jitpack.

Gradle

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
   implementation 'com.github.atomfrede:jadenticon:3.0.4'
}

Maven

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>

<dependency>
    <groupId>com.github.atomfrede</groupId>
    <artifactId>jadenticon</artifactId>
    <version>3.0.3</version>
</dependency>

Usage

// Create default jdenticon (as svg) with size 300 and padding 0.08
String rawSvg = Jadenticon.from("Jane Doe").toSvg();

// Create a jdenticon with size 555 and padding 0.08
// Restriction: 30 <= size
String rawSvgWithSize = Jadenticon.from("Jane Doe").withSize(555).toSvg();

// Create a jdenticon with size 300 and padding 0.1
// Restriction: 0 <= padding <= 0.5
String rawSvgWithPadding = Jadenticon.from("John Doe").withPadding(0.1);

// You can save it directly to a svg file, the .svg suffix is added automatically
File svgFile = Jadenticon.from("Jane Doe").file("janedoe");

// You can save it directly to a png file, the .png suffix is added automatically
File pngFile = Jadenticon.from("Janet Doe").png("janetdoe");

// If you don't care about the file you don't need to provide any
File svgFile2 = Jadenticon.from("John Doe").file();
File pngFile2 = Jadenticon.from("Johnny Doe").png();

Example

example jdenticon

License

Apache-2.0 © Frederik Hahne