Giter Site home page Giter Site logo

rheehot / geo-pattern Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mooyoul/geo-pattern

0.0 1.0 0.0 1.36 MB

Create beautiful generative geometric background images from a string ✨ TypeScript port of jasonlong/geo_pattern. Supports both Node.js and Browser.

Home Page: https://mooyoul.github.io/geo-pattern/

License: MIT License

TypeScript 88.36% HTML 4.65% JavaScript 7.00%

geo-pattern's Introduction

@prescott/geo-pattern

Build Status Github Pages Status Semantic Release enabled npm bundle size (minified, gzipped) Renovate enabled MIT license

Cover Image

Create beautiful generative geometric background images from a string ✨

@prescott/geo-pattern has visual regression tests and perfectly matches to the original geo-pattern gem outputs!

Live Demo

https://mooyoul.github.io/geo-pattern/

E2E Test Status

Browser Status Build
IE 11 BrowserStack Status ES5 Build
Edge Latest BrowserStack Status ES6 Build
Firefox Latest BrowserStack Status ES6 Build
Edge 15 BrowserStack Status ES6 Build
Chrome Latest BrowserStack Status ES6 Build, Native Build
macOS Safari Latest BrowserStack Status ES6 Build
iOS Safari Latest BrowserStack Status ES6 Build
iPadOS Safari Latest BrowserStack Status ES6 Build
Android Tab Chrome Latest BrowserStack Status ES6 Build
Android Chrome Latest BrowserStack Status ES6 Build

Getting Started

$ npm install @prescott/geo-pattern --save

API

generate(params: GeneratePatternParams) => Promise<Pattern>

interface GeneratePatternParams {
  input: string;
  patterns?: string[];
  color?: string;
  baseColor?: string;
}

interface Pattern {
  background?: Background;
  structure?: Structure;
  width: number;
  height: number;
  toSVG(): string;
  toDataURL(): string;
}
import { generate } from "@prescott/geo-pattern";
const pattern = await generate({ input: "lorem ipsum" });
const svg = pattern.toSVG();
const dataUri = pattern.toDataURL();

Browser Builds

@prescott/geo-pattern provides browser builds.

All browser builds require Promise, Map, Set, and TextEncoder. You should polyfill missing features if you need to support legacy browsers.

Currently, There are four types of Browser Build.

Type Path Notes
Default (CommonJS) dist/browser Use this build if you're using bundler like Webpack.
ES5 (UMD) browser/es5 Use this build if you want to support legacy browsers (e.g. IE 11)
ES6 (UMD) browser/es6 Use this build if you want to support modern browers only
Native (UMD) browser/native Use this build if you want to support cutting-edge browsers only

About "Native" Build

Native build uses browser built-in hash function (Crypto Subtle API)

Use @prescott/geo-pattern using unpkg

<!-- ES6 Target Build -->
<script type="text/javascript" src="https://unpkg.com/@prescott/geo-pattern/browser/es6"></script>

<!-- Native Build -->
<script type="text/javascript" src="https://unpkg.com/@prescott/geo-pattern/browser/native"></script>

<!-- ES5 Target Build (for Compat, requires Promise, Map, Set, and TextEncoder polyfill -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.6.5/core.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/@prescott/geo-pattern/browser/es5"></script>

Wishlists

  • Smaller library size

Changelog

See CHANGELOG.

Testing

$ npm run test:spec # for unit test
$ npm run test:e2e:node # for Node.js integration test
$ npm run test:e2e:browser # for Browser integration test using locally installed chrome
$ npm run test:e2e:browserstack # for Browser compability test using BrowserStack

BrowserStack Logo

@prescott/geo-pattern uses BrowserStack for compatibility testing.

Build

$ npm run build

Related

TBD

Diagram

Dependency Graph

Dependency Graph

Credits

geo-pattern was originally wrote by Jason Long. It can't be done without his efforts.

Kudos for his amazing work! <3

License

MIT

See full license on mooyoul.mit-license.org

geo-pattern's People

Contributors

renovate-bot avatar mooyoul avatar semantic-release-bot avatar

Watchers

 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.