Coder Social home page Coder Social logo

colorpalette's Introduction

ColorPalette

An easy tool to display multiples colors on your screen. It can be used to check the similitude between colors.

How to use ?

First, make sure that you include the script before creating any Palette.

<script src="colorpalette.js"></script>
<script>
  // My Palette goes here
</script>

There are two ways to create Palettes, you can pass an array or an object to the method.

1. Array

<script>
var MyPalette = new ColorPalette(['#002a4a', '#17607d', '#fff1ce', '#ff9311', '#d64700'])
</script>

ColorPalette will generate a text area with the color code and stick it to the top of each color layer.

2. Object

If you want to customize the text that is added to the layers, you can pass your colors through an object.

<script>
  var MyPalette = new ColorPalette({
    '#002a4a': 'What',
    '#17607d': 'Do you',
    '#fff1ce': 'Want',
    '#ff9311': 'From me',
    '#d64700': '' // If you don't set a value, the color code will be used
  })
</script>

Configuration

There is some configuration available in the constructor. For now, you can only define a height and a location where to append the palette.

You can do that this way :

<script>
  var MyPalette = new ColorPalette(
    /* My colors */,
    {
      height: '250px', // Default -> 100vh
      appendTo: document.getElementById('my-palette-container') // Default -> document.body
    }
  )
</script>

Credits

Example palette from color.adobe.com

colorpalette's People

Contributors

gaetanbt avatar

Watchers

 avatar  avatar

colorpalette's Issues

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.