GithubHelp home page GithubHelp logo

uvacoder / abc-colorama Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 14.44 MB

Home Page: https://colorama.vercel.app/

License: Creative Commons Attribution Share Alike 4.0 International

Pug 28.77% JavaScript 35.20% SCSS 36.02%
colors netlify mysite abcdone palette webapp abcwebapp abcwip

abc-colorama's Introduction

colors-abc

-- "Random" color palette generator. ## Farbvelo

FarbVelo (Swiss-German for color bicycle) is a playful color picking tool. It uses simple rules and lots of random numbers to help you come up with pleasing color combinations or just chill while cycling through color harmonies (I almost find it a bit psychedelic while listening to custom made white noise).

About

  1. Picking โ„•0 hue's (color stops) using HSLuv at a user defined minimum angle โˆ .
  2. Interpolating between color stops in CIE Lab* by default, using chroma.js.
  3. Finding pleasing color names using the color name API
  4. Icons made by Ravindra Kalkani.
  5. Originally released as a Codepen.
  6. Source is on github and licensed under a Creative Commons Attribution Share Alike 4.0 license.

Engine

If you are anything like me, you are probably here to find out how the color picking works. Since this code is based on an old project and the code is very messy, let me help you:

// minHueDiffAngle = 60

// create an array of hues to pick from.
  const baseHue = random(0, 360);
  const hues = new Array(Math.round( 360 / minHueDiffAngle) ).fill('').map((offset, i) => {
    return (baseHue + i * minHueDiffAngle) % 360;
  });

  //  low saturation color
  const baseSaturation = random(5, 40);
  const baseLightness = random(0, 20);
  const rangeLightness = 90 - baseLightness;

  colors.push(
    hsluvToHex([
      hues[0],
      baseSaturation,
      baseLightness * random(0.25, 0.75),
    ])
  );

  // random shades
  const minSat = random(50, 70);
  const maxSat = minSat + 30;
  const minLight = random(35, 70);
  const maxLight = Math.min(minLight + random(20, 40), 95);
  // const lightDiff = maxLight - minLight;

  const remainingHues = [...hues];

  for (let i = 0; i < parts - 2; i++) {
    const hue = remainingHues.splice(random(0, remainingHues.length - 1),1)[0];
    const saturation = random(minSat, maxSat);
    const light = baseLightness + random(0,10) + ((rangeLightness/(parts - 1)) * i);

    colors.push( 
      hsluvToHex([
        hue,
        saturation,
        random(light, maxLight),
      ])
    )
  }
  
  colors.push( 
    hsluvToHex([
      remainingHues[0],
      baseSaturation,
      rangeLightness + 10,
    ])
  );

  chroma.scale(colors)
        .padding(.175)
        .mode('lab')
        .colors(6);

Samples

sample screenshot of color bingo engine sample screenshot of color bingo engine sample screenshot of color bingo engine sample screenshot of color bingo engine sample screenshot of color bingo engine sample screenshot of color bingo engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine sample screenshot of legacy engine

abc-colorama's People

Contributors

meodai avatar uvacoder avatar

Stargazers

 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.