GithubHelp home page GithubHelp logo

blockies's Introduction

Blockies TypeScript SVG DataURI Library

An TypeScript inspired repository from the original @download/blockies.

Blockies Examples


Getting Start

# FROM: ./path/to/project

npm install @codingwithmanny/blockies; # pnpm add @codingwithmanny/blockies

Node

// Imports
// ========================================================
import { renderSVGIcon } from '@codingwithmanny/blockies';

// Main Script
// ========================================================
(async () => {
    const svg = await renderSVGIcon({ seed: '0xB3f03B93F0bd65B960EE950d9aFC6867D461C33f' });
    console.log({ svg });
    // '<svg width="32" height="32" viewBox="0 0 32 32" fill="hsl(0,40%,0%)"...'
})();

ViteJS / NextJS

// Imports
// ========================================================
import { type NextPage } from "next";
import { renderSVGIcon, renderDataURI } from '@codingwithmanny/blockies';

// Constants
// ========================================================
const WALLET_ADDRESS = '0xB3f03B93F0bd65B960EE950d9aFC6867D461C33f';

// Page Component
// ========================================================
const Home: NextPage = () => {
    return <div>
        {/* SVG */}
        {renderSVGIcon({ seed: WALLET_ADDRESS })}

        {/* Date URI */}
        <img src={renderDataURI({ seed: WALLET_ADDRESS })} />
    </div>
};

Building

If cloning the repository.

# FROM: ./

pnpm build;

# Expected Output:
# > @cwm/[email protected] build /Users/username/path/to/blockies-ts
# > tsup
# 
# CLI Building entry: src/index.ts
# CLI Using tsconfig: tsconfig.json
# CLI tsup v6.7.0
# CLI Using tsup config: /Users/username/path/to/blockies-ts/tsup.config.ts
# CLI Target: es2016
# CLI Cleaning output folder
# CJS Build start
# CJS dist/index.js     5.55 KB
# CJS dist/index.js.map 7.08 KB
# CJS ⚡️ Build success in 6ms
# DTS Build start
# DTS ⚡️ Build success in 520ms
# DTS dist/index.d.ts 1.33 KB

Testing

If cloning the repository.

# FROM: ./

pnpm test;

# Expected Output:
# Expected Output:
# > @cwm/[email protected] build /Users/username/path/to/blockies-ts
# > tsup
# 
# CLI Building entry: src/index.ts
# CLI Using tsconfig: tsconfig.json
# CLI tsup v6.7.0
# CLI Using tsup config: /Users/username/path/to/blockies-ts/tsup.config.ts
# CLI Target: es2016
# CLI Cleaning output folder
# CJS Build start
# CJS dist/index.js     5.55 KB
# CJS dist/index.js.map 7.08 KB
# CJS ⚡️ Build success in 6ms
# DTS Build start
# DTS ⚡️ Build success in 520ms
# DTS dist/index.d.ts 1.33 KB
# TAP version 13
# # Subtest: randSeed
#     # Subtest: isArray
#     ok 1 - isArray
#       ---
#       duration_ms: 0.306875
#       ...
#     # Subtest: length = 4
#     ok 2 - length = 4
#       ---
#       duration_ms: 0.040875
#       ...
#     1..2
# ...
# 1..8
# # tests 8
# # pass 8
# # fail 0
# # cancelled 0
# # skipped 0
# # todo 0
# # duration_ms 11.698916

blockies's People

Contributors

codingwithmanny 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.