项目作者: meodai

项目描述 :
"Random" color palette generator, cycles
高级语言: SCSS
项目地址: git://github.com/meodai/farbvelo.git
创建时间: 2020-11-30T21:59:00Z
项目社区:https://github.com/meodai/farbvelo

开源协议:Creative Commons Attribution Share Alike 4.0 International

下载


FarbVelo

“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:

  1. // minHueDiffAngle = 60
  2. // create an array of hues to pick from.
  3. const baseHue = random(0, 360);
  4. const hues = new Array(Math.round( 360 / minHueDiffAngle) ).fill('').map((offset, i) => {
  5. return (baseHue + i * minHueDiffAngle) % 360;
  6. });
  7. // low saturation color
  8. const baseSaturation = random(5, 40);
  9. const baseLightness = random(0, 20);
  10. const rangeLightness = 90 - baseLightness;
  11. colors.push(
  12. hsluvToHex([
  13. hues[0],
  14. baseSaturation,
  15. baseLightness * random(0.25, 0.75),
  16. ])
  17. );
  18. // random shades
  19. const minSat = random(50, 70);
  20. const maxSat = minSat + 30;
  21. const minLight = random(35, 70);
  22. const maxLight = Math.min(minLight + random(20, 40), 95);
  23. // const lightDiff = maxLight - minLight;
  24. const remainingHues = [...hues];
  25. for (let i = 0; i < parts - 2; i++) {
  26. const hue = remainingHues.splice(random(0, remainingHues.length - 1),1)[0];
  27. const saturation = random(minSat, maxSat);
  28. const light = baseLightness + random(0,10) + ((rangeLightness/(parts - 1)) * i);
  29. colors.push(
  30. hsluvToHex([
  31. hue,
  32. saturation,
  33. random(light, maxLight),
  34. ])
  35. )
  36. }
  37. colors.push(
  38. hsluvToHex([
  39. remainingHues[0],
  40. baseSaturation,
  41. rangeLightness + 10,
  42. ])
  43. );
  44. chroma.scale(colors)
  45. .padding(.175)
  46. .mode('lab')
  47. .colors(6);

Techstack & Credits

  • Icons: iconoir
  • Vue
  • Chroma.js
  • Inter Font
  • Space Mono Font

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