Code Monkey home page Code Monkey logo

coolors-io's Introduction

coolors-io

A simple JS script to parse or generate Coolors.co URLs to/from an array of hex values

Note: this project is in no way affiliated with Coolors.co and makes no guarantees about the stability of the coolors API. Based on the API as observed on 06/20/2020

Purpose:

Coolors.co has a great interface for rapidly creating color palettes and I wanted a way to more easily integrate it into my dev work

About Coolors URLs

Coolors URLs follow the format:

https://coolors.co/HEX-HEX-HEX-HEX-HEX-HEX

For example:

https://coolors.co/c3f73a-95e06c-68b684-094d92-1c1018

Notes:

  • Coolors URLs do not include '#'
  • Coolors URLs can have 1 - 10 hex values
    • Less than one will point to the landing page
    • More than ten will return a 404 error
  • The order of hex values is significant in Coolors URLs and is preserved in parse and gen

Getting Started

npm install coolors-io

coolors.parse

  import { parse } from 'coolors-io'

  const exampleCoolor = 'https://coolors.co/243cf2-9e8f19-a81470-4553bf-4a5396'

  parse(exampleCoolor)
    // returns [ '#898952', '#b2945b', '#d0e562', '#b6d369', '#93c48b' ]
    .then(console.log)

coolors.gen

  import { gen } from 'coolors-io'

  const exampleArray = ['feffef', '#ffeffe']

  gen(exampleArray)
    // returns https://coolors.co/feffef-ffeffe
    .then(console.log)

coolors-io's People

Contributors

delesslin avatar

Watchers

James Cloos 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.