diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..a656ce9 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,11 @@ +changelog: + categories: + - title: 🆕 Features + labels: + - '*' + exclude: + labels: + - dependencies + - title: 🧱 Dependencies + labels: + - dependencies diff --git a/CHANGELOG.md b/CHANGELOG.md index b985f84..c413e18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# [0.7.0](https://github.com/famebot/chromagen/compare/v0.6.0...v0.7.0) (2023-10-15) + + +### Features + +* rename chromagen ([7efc2e3](https://github.com/famebot/chromagen/commit/7efc2e3f766d3f40def68e2d4bb34cf58a004f3f)) + + + # [0.6.0](https://github.com/famebot/hsl-gen/compare/v0.5.1...v0.6.0) (2023-04-09) diff --git a/README.md b/README.md index d220fd2..10c3139 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,50 @@ -# HSL Gen +# Chromagen -HSL Gen (`hsl-gen`) generates HSL color schemes. +Chromagen generates HSL color schemes. -- [Demo](https://hsl-gen.netlify.app) -- [HSL Gen on GitHub](https://github.com/famebot/hsl-gen) -- [@famebot/hsl-gen on npm](https://www.npmjs.com/package/@famebot/hsl-gen) +- [Demo](https://chromagen.io) +- [Chromagen on GitHub](https://github.com/famebot/chromagen) +- [@famebot/chromagen on npm](https://www.npmjs.com/package/@famebot/chromagen) -[![npm Version](https://img.shields.io/npm/v/@famebot/hsl-gen.svg?style=for-the-badge)](https://www.npmjs.com/package/@famebot/hsl-gen)   [![GitHub issues](https://img.shields.io/github/issues/famebot/hsl-gen.svg?style=for-the-badge)](https://github.com/famebot/hsl-gen/issues) +[![npm Version](https://img.shields.io/npm/v/@famebot/chromagen.svg?style=for-the-badge)](https://www.npmjs.com/package/@famebot/chromagen)   [![GitHub issues](https://img.shields.io/github/issues/famebot/chromagen.svg?style=for-the-badge)](https://github.com/famebot/chromagen/issues) ## Installation and Usage -HSL Gen uses [Microbundle](https://github.com/developit/microbundle) to produce ESM ([ECMAScript modules](https://nodejs.org/api/esm.html)), CJS ([CommonJS](https://nodejs.org/api/modules.html)), and UMD ([Universal Module Definition](https://github.com/umdjs/umd)) bundles that work in various environments. +Chromagen uses [Microbundle](https://github.com/developit/microbundle) to produce ESM ([ECMAScript modules](https://nodejs.org/api/esm.html)), CJS ([CommonJS](https://nodejs.org/api/modules.html)), and UMD ([Universal Module Definition](https://github.com/umdjs/umd)) bundles that work in various environments. ### Node.js and similar environments ```bash -npm i @famebot/hsl-gen +npm i @famebot/chromagen ``` ```js -import hslGen from '@famebot/hsl-gen'; -const colorScheme = hslGen(); +import chromagen from '@famebot/chromagen'; +const colorScheme = chromagen(); console.log(colorScheme); ``` CommonJS `require` syntax: ```js -const hslGen = require('@famebot/hsl-gen'); -const colorScheme = hslGen(); +const chromagen = require('@famebot/chromagen'); +const colorScheme = chromagen(); console.log(colorScheme); ``` ### Browser use client-side -For browser use, include `dist/hsl-gen.umd.js` or use [unpkg](https://unpkg.com), which `examples/browser-umd/index.html` demonstrates. View the latest version at +For browser use, include `dist/chromagen.umd.js` or use [unpkg](https://unpkg.com), which `examples/browser-umd/index.html` demonstrates. View the latest version at Latest UMD bundle on unpkg: - + Using the UMD bundle in the browser: ```html - + ``` diff --git a/dist/hsl-gen.cjs b/dist/chromagen.cjs similarity index 96% rename from dist/hsl-gen.cjs rename to dist/chromagen.cjs index d52205f..3d592fc 100644 --- a/dist/hsl-gen.cjs +++ b/dist/chromagen.cjs @@ -1,2 +1,2 @@ var l=function(l,h){return Math.floor(Math.random()*(h-l+1))+l};module.exports=function(){var h,s=l(1,359),a=s>180?s-180:s+179;switch(s){case s<135:h=s+224;break;case s>224:h=s-223;break;default:var r=s+225;h=r>359?r-359:r}var e=l(80,100),d=l(64,80),n=l(0,24),o=n<8?16:0,t=d>76?68:84,u=l(28,36),i=l(48,64),m=l(84,92);return{hue:s,complement:a,analogous:h,saturation:e,xlight:m,lighter:t,lightness:d,midrange:i,lowmid:u,darkness:n,darker:o,huehsl:"hsl("+s+", "+e+"%, "+d+"%)",huehsllighter:"hsl("+s+", "+e+"%, "+t+"%)",huehslxlight:"hsl("+s+", "+e+"%, "+m+"%)",darkhuehsl:"hsl("+s+", "+e+"%, "+n+"%)",darkhuehsldarker:"hsl("+s+", "+e+"%, "+o+"%)",darkhuehsllowmid:"hsl("+s+", "+e+"%, "+u+"%)",comphsl:"hsl("+a+", "+e+"%, "+d+"%)",comphslmid:"hsl("+a+", "+e+"%, "+i+"%)",comphsldark:"hsl("+a+", "+e+"%, "+n+"%)",comphsldarker:"hsl("+a+", "+e+"%, "+o+"%)",analhsl:"hsl("+h+", "+e+"%, "+d+"%)",analhslmid:"hsl("+h+", "+e+"%, "+i+"%)",analhsldark:"hsl("+h+", "+e+"%, "+n+"%)",analhsldarker:"hsl("+h+", "+e+"%, "+o+"%)"}}; -//# sourceMappingURL=hsl-gen.cjs.map +//# sourceMappingURL=chromagen.cjs.map diff --git a/dist/chromagen.cjs.map b/dist/chromagen.cjs.map new file mode 100644 index 0000000..8c9b08b --- /dev/null +++ b/dist/chromagen.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"chromagen.cjs","sources":["../src/index.js"],"sourcesContent":["// Returns a random integer between min (included) and max (included)\n// Math.floor because Math.round() yields non-uniform distribution\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random\nconst getRandomIntInclusive = (min, max) => {\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n};\n\nexport default () => {\n\t// Seed the primary color\n\tconst hue = getRandomIntInclusive(1, 359);\n\t// Comment out above line and uncomment below to test specific values\n\t// var hue = 9; // 128 173 (test values)\n\n\t// Set complement (secondary) and empty analogous (tertiary) values\n\tvar complement = hue > 180 ? hue - 180 : hue + 179;\n\n\tvar analogous;\n\tswitch (hue) {\n\t\tcase hue < 135:\n\t\t\tanalogous = hue + 224;\n\t\t\tbreak;\n\t\tcase hue > 224:\n\t\t\tanalogous = hue - 223;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvar shift = hue + 225;\n\t\t\tanalogous = shift > 359 ? shift - 359 : shift;\n\t}\n\n\t// Seed random saturation and lightness within acceptable parameters for light and dark text.\n\tconst saturation = getRandomIntInclusive(80, 100);\n\t// very light or white text\n\tconst lightness = getRandomIntInclusive(64, 80);\n\t// very dark or black text\n\tconst darkness = getRandomIntInclusive(0, 24);\n\t\n\t// typically a more extreme darkness/lightness unless the value is already\n\t// extreme then a moderate value to contrast well with the extreme value\n\tlet darker = darkness < 8 ? 16 : 0;\n\tlet lighter = lightness > 76 ? 68 : 84;\n\n\t// Create other mixing values\n\n\t// dark highlight\n\tconst lowmid = getRandomIntInclusive(28, 36);\n\t// mid value used for lightness and saturation\n\tconst midrange = getRandomIntInclusive(48, 64);\n\t// highlight\n\tconst xlight = getRandomIntInclusive(84, 92);\n\n\treturn {\n\t\t// raw mixing values\n\t\thue: hue,\n\t\tcomplement: complement,\n\t\tanalogous: analogous,\n\t\tsaturation: saturation,\n\t\txlight: xlight,\n\t\tlighter: lighter,\n\t\tlightness: lightness,\n\t\tmidrange: midrange,\n\t\tlowmid: lowmid,\n\t\tdarkness: darkness,\n\t\tdarker: darker,\n\t\t// primary hue: light and dark\n\t\thuehsl: `hsl(${hue}, ${saturation}%, ${lightness}%)`,\n\t\thuehsllighter: `hsl(${hue}, ${saturation}%, ${lighter}%)`,\n\t\thuehslxlight: `hsl(${hue}, ${saturation}%, ${xlight}%)`,\n\t\tdarkhuehsl: `hsl(${hue}, ${saturation}%, ${darkness}%)`,\n\t\tdarkhuehsldarker: `hsl(${hue}, ${saturation}%, ${darker}%)`,\n\t\tdarkhuehsllowmid: `hsl(${hue}, ${saturation}%, ${lowmid}%)`,\n\t\t// complement\n\t\tcomphsl: `hsl(${complement}, ${saturation}%, ${lightness}%)`,\n\t\tcomphslmid: `hsl(${complement}, ${saturation}%, ${midrange}%)`,\n\t\tcomphsldark: `hsl(${complement}, ${saturation}%, ${darkness}%)`,\n\t\tcomphsldarker: `hsl(${complement}, ${saturation}%, ${darker}%)`,\n\t\t// analogous\n\t\tanalhsl: `hsl(${analogous}, ${saturation}%, ${lightness}%)`,\n\t\tanalhslmid: `hsl(${analogous}, ${saturation}%, ${midrange}%)`,\n\t\tanalhsldark: `hsl(${analogous}, ${saturation}%, ${darkness}%)`,\n\t\tanalhsldarker: `hsl(${analogous}, ${saturation}%, ${darker}%)`\n\t};\n};\n"],"names":["getRandomIntInclusive","min","max","Math","floor","random","analogous","hue","complement","shift","saturation","lightness","darkness","darker","lighter","lowmid","midrange","xlight","huehsl","huehsllighter","huehslxlight","darkhuehsl","darkhuehsldarker","darkhuehsllowmid","comphsl","comphslmid","comphsldark","comphsldarker","analhsl","analhslmid","analhsldark","analhsldarker"],"mappings":"AAGA,IAAMA,EAAwB,SAACC,EAAKC,GACnC,OAAOC,KAAKC,MAAMD,KAAKE,UAAYH,EAAMD,EAAM,IAAMA,CACtD,4BAIC,IAOIK,EAPEC,EAAMP,EAAsB,EAAG,KAKjCQ,EAAaD,EAAM,IAAMA,EAAM,IAAMA,EAAM,IAG/C,OAAQA,GACP,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,QACC,IAAIE,EAAQF,EAAM,IAClBD,EAAYG,EAAQ,IAAMA,EAAQ,IAAMA,EAI1C,IAAMC,EAAaV,EAAsB,GAAI,KAEvCW,EAAYX,EAAsB,GAAI,IAEtCY,EAAWZ,EAAsB,EAAG,IAItCa,EAASD,EAAW,EAAI,GAAK,EAC7BE,EAAUH,EAAY,GAAK,GAAK,GAK9BI,EAASf,EAAsB,GAAI,IAEnCgB,EAAWhB,EAAsB,GAAI,IAErCiB,EAASjB,EAAsB,GAAI,IAEzC,MAAO,CAENO,IAAKA,EACLC,WAAYA,EACZF,UAAWA,EACXI,WAAYA,EACZO,OAAQA,EACRH,QAASA,EACTH,UAAWA,EACXK,SAAUA,EACVD,OAAQA,EACRH,SAAUA,EACVC,OAAQA,EAERK,cAAeX,EAAG,KAAKG,EAAgBC,MAAAA,OACvCQ,qBAAsBZ,EAAG,KAAKG,EAAgBI,MAAAA,OAC9CM,oBAAqBb,EAAG,KAAKG,EAAgBO,MAAAA,OAC7CI,kBAAmBd,EAAG,KAAKG,EAAgBE,MAAAA,OAC3CU,wBAAyBf,EAAG,KAAKG,EAAgBG,MAAAA,OACjDU,wBAAyBhB,EAAG,KAAKG,EAAgBK,MAAAA,OAEjDS,eAAgBhB,EAAU,KAAKE,EAAgBC,MAAAA,OAC/Cc,kBAAmBjB,EAAU,KAAKE,EAAgBM,MAAAA,OAClDU,mBAAoBlB,EAAU,KAAKE,EAAgBE,MAAAA,OACnDe,qBAAsBnB,EAAU,KAAKE,EAAgBG,MAAAA,OAErDe,eAAgBtB,EAAS,KAAKI,EAAgBC,MAAAA,OAC9CkB,kBAAmBvB,EAAS,KAAKI,EAAgBM,MAAAA,OACjDc,mBAAoBxB,EAAS,KAAKI,EAAgBE,MAAAA,OAClDmB,qBAAsBzB,EAAS,KAAKI,EAAgBG,MAAAA,EACrD,KACA"} \ No newline at end of file diff --git a/dist/hsl-gen.modern.js b/dist/chromagen.modern.js similarity index 95% rename from dist/hsl-gen.modern.js rename to dist/chromagen.modern.js index c634ffc..743ff07 100644 --- a/dist/hsl-gen.modern.js +++ b/dist/chromagen.modern.js @@ -1,2 +1,2 @@ const l=(l,h)=>Math.floor(Math.random()*(h-l+1))+l;var h=()=>{const h=l(1,359);var s,$=h>180?h-180:h+179;switch(h){case h<135:s=h+224;break;case h>224:s=h-223;break;default:var a=h+225;s=a>359?a-359:a}const r=l(80,100),e=l(64,80),t=l(0,24);let d=t<8?16:0,o=e>76?68:84;const n=l(28,36),c=l(48,64),i=l(84,92);return{hue:h,complement:$,analogous:s,saturation:r,xlight:i,lighter:o,lightness:e,midrange:c,lowmid:n,darkness:t,darker:d,huehsl:`hsl(${h}, ${r}%, ${e}%)`,huehsllighter:`hsl(${h}, ${r}%, ${o}%)`,huehslxlight:`hsl(${h}, ${r}%, ${i}%)`,darkhuehsl:`hsl(${h}, ${r}%, ${t}%)`,darkhuehsldarker:`hsl(${h}, ${r}%, ${d}%)`,darkhuehsllowmid:`hsl(${h}, ${r}%, ${n}%)`,comphsl:`hsl(${$}, ${r}%, ${e}%)`,comphslmid:`hsl(${$}, ${r}%, ${c}%)`,comphsldark:`hsl(${$}, ${r}%, ${t}%)`,comphsldarker:`hsl(${$}, ${r}%, ${d}%)`,analhsl:`hsl(${s}, ${r}%, ${e}%)`,analhslmid:`hsl(${s}, ${r}%, ${c}%)`,analhsldark:`hsl(${s}, ${r}%, ${t}%)`,analhsldarker:`hsl(${s}, ${r}%, ${d}%)`}};export{h as default}; -//# sourceMappingURL=hsl-gen.modern.js.map +//# sourceMappingURL=chromagen.modern.js.map diff --git a/dist/chromagen.modern.js.map b/dist/chromagen.modern.js.map new file mode 100644 index 0000000..c9f88cd --- /dev/null +++ b/dist/chromagen.modern.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chromagen.modern.js","sources":["../src/index.js"],"sourcesContent":["// Returns a random integer between min (included) and max (included)\n// Math.floor because Math.round() yields non-uniform distribution\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random\nconst getRandomIntInclusive = (min, max) => {\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n};\n\nexport default () => {\n\t// Seed the primary color\n\tconst hue = getRandomIntInclusive(1, 359);\n\t// Comment out above line and uncomment below to test specific values\n\t// var hue = 9; // 128 173 (test values)\n\n\t// Set complement (secondary) and empty analogous (tertiary) values\n\tvar complement = hue > 180 ? hue - 180 : hue + 179;\n\n\tvar analogous;\n\tswitch (hue) {\n\t\tcase hue < 135:\n\t\t\tanalogous = hue + 224;\n\t\t\tbreak;\n\t\tcase hue > 224:\n\t\t\tanalogous = hue - 223;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvar shift = hue + 225;\n\t\t\tanalogous = shift > 359 ? shift - 359 : shift;\n\t}\n\n\t// Seed random saturation and lightness within acceptable parameters for light and dark text.\n\tconst saturation = getRandomIntInclusive(80, 100);\n\t// very light or white text\n\tconst lightness = getRandomIntInclusive(64, 80);\n\t// very dark or black text\n\tconst darkness = getRandomIntInclusive(0, 24);\n\t\n\t// typically a more extreme darkness/lightness unless the value is already\n\t// extreme then a moderate value to contrast well with the extreme value\n\tlet darker = darkness < 8 ? 16 : 0;\n\tlet lighter = lightness > 76 ? 68 : 84;\n\n\t// Create other mixing values\n\n\t// dark highlight\n\tconst lowmid = getRandomIntInclusive(28, 36);\n\t// mid value used for lightness and saturation\n\tconst midrange = getRandomIntInclusive(48, 64);\n\t// highlight\n\tconst xlight = getRandomIntInclusive(84, 92);\n\n\treturn {\n\t\t// raw mixing values\n\t\thue: hue,\n\t\tcomplement: complement,\n\t\tanalogous: analogous,\n\t\tsaturation: saturation,\n\t\txlight: xlight,\n\t\tlighter: lighter,\n\t\tlightness: lightness,\n\t\tmidrange: midrange,\n\t\tlowmid: lowmid,\n\t\tdarkness: darkness,\n\t\tdarker: darker,\n\t\t// primary hue: light and dark\n\t\thuehsl: `hsl(${hue}, ${saturation}%, ${lightness}%)`,\n\t\thuehsllighter: `hsl(${hue}, ${saturation}%, ${lighter}%)`,\n\t\thuehslxlight: `hsl(${hue}, ${saturation}%, ${xlight}%)`,\n\t\tdarkhuehsl: `hsl(${hue}, ${saturation}%, ${darkness}%)`,\n\t\tdarkhuehsldarker: `hsl(${hue}, ${saturation}%, ${darker}%)`,\n\t\tdarkhuehsllowmid: `hsl(${hue}, ${saturation}%, ${lowmid}%)`,\n\t\t// complement\n\t\tcomphsl: `hsl(${complement}, ${saturation}%, ${lightness}%)`,\n\t\tcomphslmid: `hsl(${complement}, ${saturation}%, ${midrange}%)`,\n\t\tcomphsldark: `hsl(${complement}, ${saturation}%, ${darkness}%)`,\n\t\tcomphsldarker: `hsl(${complement}, ${saturation}%, ${darker}%)`,\n\t\t// analogous\n\t\tanalhsl: `hsl(${analogous}, ${saturation}%, ${lightness}%)`,\n\t\tanalhslmid: `hsl(${analogous}, ${saturation}%, ${midrange}%)`,\n\t\tanalhsldark: `hsl(${analogous}, ${saturation}%, ${darkness}%)`,\n\t\tanalhsldarker: `hsl(${analogous}, ${saturation}%, ${darker}%)`\n\t};\n};\n"],"names":["getRandomIntInclusive","min","max","Math","floor","random","hue","analogous","complement","shift","saturation","lightness","darkness","darker","lighter","lowmid","midrange","xlight","huehsl","huehsllighter","huehslxlight","darkhuehsl","darkhuehsldarker","darkhuehsllowmid","comphsl","comphslmid","comphsldark","comphsldarker","analhsl","analhslmid","analhsldark","analhsldarker"],"mappings":"AAGA,MAAMA,EAAwBA,CAACC,EAAKC,IAC5BC,KAAKC,MAAMD,KAAKE,UAAYH,EAAMD,EAAM,IAAMA,EAGtD,WAEC,MAAMK,EAAMN,EAAsB,EAAG,KAKrC,IAEIO,EAFAC,EAAaF,EAAM,IAAMA,EAAM,IAAMA,EAAM,IAG/C,OAAQA,GACP,KAAKA,EAAM,IACVC,EAAYD,EAAM,IAClB,MACD,KAAKA,EAAM,IACVC,EAAYD,EAAM,IAClB,MACD,QACC,IAAIG,EAAQH,EAAM,IAClBC,EAAYE,EAAQ,IAAMA,EAAQ,IAAMA,EAI1C,MAAMC,EAAaV,EAAsB,GAAI,KAEvCW,EAAYX,EAAsB,GAAI,IAEtCY,EAAWZ,EAAsB,EAAG,IAI1C,IAAIa,EAASD,EAAW,EAAI,GAAK,EAC7BE,EAAUH,EAAY,GAAK,GAAK,GAKpC,MAAMI,EAASf,EAAsB,GAAI,IAEnCgB,EAAWhB,EAAsB,GAAI,IAErCiB,EAASjB,EAAsB,GAAI,IAEzC,MAAO,CAENM,IAAKA,EACLE,WAAYA,EACZD,UAAWA,EACXG,WAAYA,EACZO,OAAQA,EACRH,QAASA,EACTH,UAAWA,EACXK,SAAUA,EACVD,OAAQA,EACRH,SAAUA,EACVC,OAAQA,EAERK,OAAS,OAAMZ,MAAQI,OAAgBC,MACvCQ,cAAgB,OAAMb,MAAQI,OAAgBI,MAC9CM,aAAe,OAAMd,MAAQI,OAAgBO,MAC7CI,WAAa,OAAMf,MAAQI,OAAgBE,MAC3CU,iBAAmB,OAAMhB,MAAQI,OAAgBG,MACjDU,iBAAmB,OAAMjB,MAAQI,OAAgBK,MAEjDS,QAAU,OAAMhB,MAAeE,OAAgBC,MAC/Cc,WAAa,OAAMjB,MAAeE,OAAgBM,MAClDU,YAAc,OAAMlB,MAAeE,OAAgBE,MACnDe,cAAgB,OAAMnB,MAAeE,OAAgBG,MAErDe,QAAU,OAAMrB,MAAcG,OAAgBC,MAC9CkB,WAAa,OAAMtB,MAAcG,OAAgBM,MACjDc,YAAc,OAAMvB,MAAcG,OAAgBE,MAClDmB,cAAgB,OAAMxB,MAAcG,OAAgBG,MAErD"} \ No newline at end of file diff --git a/dist/hsl-gen.module.js b/dist/chromagen.module.js similarity index 95% rename from dist/hsl-gen.module.js rename to dist/chromagen.module.js index 337dae6..e9191d6 100644 --- a/dist/hsl-gen.module.js +++ b/dist/chromagen.module.js @@ -1,2 +1,2 @@ var l=function(l,h){return Math.floor(Math.random()*(h-l+1))+l},h=function(){var h,s=l(1,359),a=s>180?s-180:s+179;switch(s){case s<135:h=s+224;break;case s>224:h=s-223;break;default:var r=s+225;h=r>359?r-359:r}var e=l(80,100),d=l(64,80),t=l(0,24),n=t<8?16:0,o=d>76?68:84,u=l(28,36),i=l(48,64),k=l(84,92);return{hue:s,complement:a,analogous:h,saturation:e,xlight:k,lighter:o,lightness:d,midrange:i,lowmid:u,darkness:t,darker:n,huehsl:"hsl("+s+", "+e+"%, "+d+"%)",huehsllighter:"hsl("+s+", "+e+"%, "+o+"%)",huehslxlight:"hsl("+s+", "+e+"%, "+k+"%)",darkhuehsl:"hsl("+s+", "+e+"%, "+t+"%)",darkhuehsldarker:"hsl("+s+", "+e+"%, "+n+"%)",darkhuehsllowmid:"hsl("+s+", "+e+"%, "+u+"%)",comphsl:"hsl("+a+", "+e+"%, "+d+"%)",comphslmid:"hsl("+a+", "+e+"%, "+i+"%)",comphsldark:"hsl("+a+", "+e+"%, "+t+"%)",comphsldarker:"hsl("+a+", "+e+"%, "+n+"%)",analhsl:"hsl("+h+", "+e+"%, "+d+"%)",analhslmid:"hsl("+h+", "+e+"%, "+i+"%)",analhsldark:"hsl("+h+", "+e+"%, "+t+"%)",analhsldarker:"hsl("+h+", "+e+"%, "+n+"%)"}};export{h as default}; -//# sourceMappingURL=hsl-gen.module.js.map +//# sourceMappingURL=chromagen.module.js.map diff --git a/dist/chromagen.module.js.map b/dist/chromagen.module.js.map new file mode 100644 index 0000000..d37fa08 --- /dev/null +++ b/dist/chromagen.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chromagen.module.js","sources":["../src/index.js"],"sourcesContent":["// Returns a random integer between min (included) and max (included)\n// Math.floor because Math.round() yields non-uniform distribution\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random\nconst getRandomIntInclusive = (min, max) => {\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n};\n\nexport default () => {\n\t// Seed the primary color\n\tconst hue = getRandomIntInclusive(1, 359);\n\t// Comment out above line and uncomment below to test specific values\n\t// var hue = 9; // 128 173 (test values)\n\n\t// Set complement (secondary) and empty analogous (tertiary) values\n\tvar complement = hue > 180 ? hue - 180 : hue + 179;\n\n\tvar analogous;\n\tswitch (hue) {\n\t\tcase hue < 135:\n\t\t\tanalogous = hue + 224;\n\t\t\tbreak;\n\t\tcase hue > 224:\n\t\t\tanalogous = hue - 223;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvar shift = hue + 225;\n\t\t\tanalogous = shift > 359 ? shift - 359 : shift;\n\t}\n\n\t// Seed random saturation and lightness within acceptable parameters for light and dark text.\n\tconst saturation = getRandomIntInclusive(80, 100);\n\t// very light or white text\n\tconst lightness = getRandomIntInclusive(64, 80);\n\t// very dark or black text\n\tconst darkness = getRandomIntInclusive(0, 24);\n\t\n\t// typically a more extreme darkness/lightness unless the value is already\n\t// extreme then a moderate value to contrast well with the extreme value\n\tlet darker = darkness < 8 ? 16 : 0;\n\tlet lighter = lightness > 76 ? 68 : 84;\n\n\t// Create other mixing values\n\n\t// dark highlight\n\tconst lowmid = getRandomIntInclusive(28, 36);\n\t// mid value used for lightness and saturation\n\tconst midrange = getRandomIntInclusive(48, 64);\n\t// highlight\n\tconst xlight = getRandomIntInclusive(84, 92);\n\n\treturn {\n\t\t// raw mixing values\n\t\thue: hue,\n\t\tcomplement: complement,\n\t\tanalogous: analogous,\n\t\tsaturation: saturation,\n\t\txlight: xlight,\n\t\tlighter: lighter,\n\t\tlightness: lightness,\n\t\tmidrange: midrange,\n\t\tlowmid: lowmid,\n\t\tdarkness: darkness,\n\t\tdarker: darker,\n\t\t// primary hue: light and dark\n\t\thuehsl: `hsl(${hue}, ${saturation}%, ${lightness}%)`,\n\t\thuehsllighter: `hsl(${hue}, ${saturation}%, ${lighter}%)`,\n\t\thuehslxlight: `hsl(${hue}, ${saturation}%, ${xlight}%)`,\n\t\tdarkhuehsl: `hsl(${hue}, ${saturation}%, ${darkness}%)`,\n\t\tdarkhuehsldarker: `hsl(${hue}, ${saturation}%, ${darker}%)`,\n\t\tdarkhuehsllowmid: `hsl(${hue}, ${saturation}%, ${lowmid}%)`,\n\t\t// complement\n\t\tcomphsl: `hsl(${complement}, ${saturation}%, ${lightness}%)`,\n\t\tcomphslmid: `hsl(${complement}, ${saturation}%, ${midrange}%)`,\n\t\tcomphsldark: `hsl(${complement}, ${saturation}%, ${darkness}%)`,\n\t\tcomphsldarker: `hsl(${complement}, ${saturation}%, ${darker}%)`,\n\t\t// analogous\n\t\tanalhsl: `hsl(${analogous}, ${saturation}%, ${lightness}%)`,\n\t\tanalhslmid: `hsl(${analogous}, ${saturation}%, ${midrange}%)`,\n\t\tanalhsldark: `hsl(${analogous}, ${saturation}%, ${darkness}%)`,\n\t\tanalhsldarker: `hsl(${analogous}, ${saturation}%, ${darker}%)`\n\t};\n};\n"],"names":["getRandomIntInclusive","min","max","Math","floor","random","index","analogous","hue","complement","shift","saturation","lightness","darkness","darker","lighter","lowmid","midrange","xlight","huehsl","huehsllighter","huehslxlight","darkhuehsl","darkhuehsldarker","darkhuehsllowmid","comphsl","comphslmid","comphsldark","comphsldarker","analhsl","analhslmid","analhsldark","analhsldarker"],"mappings":"AAGA,IAAMA,EAAwB,SAACC,EAAKC,GACnC,OAAOC,KAAKC,MAAMD,KAAKE,UAAYH,EAAMD,EAAM,IAAMA,CACtD,EAEAK,aAEC,IAOIC,EAPEC,EAAMR,EAAsB,EAAG,KAKjCS,EAAaD,EAAM,IAAMA,EAAM,IAAMA,EAAM,IAG/C,OAAQA,GACP,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,QACC,IAAIE,EAAQF,EAAM,IAClBD,EAAYG,EAAQ,IAAMA,EAAQ,IAAMA,EAI1C,IAAMC,EAAaX,EAAsB,GAAI,KAEvCY,EAAYZ,EAAsB,GAAI,IAEtCa,EAAWb,EAAsB,EAAG,IAItCc,EAASD,EAAW,EAAI,GAAK,EAC7BE,EAAUH,EAAY,GAAK,GAAK,GAK9BI,EAAShB,EAAsB,GAAI,IAEnCiB,EAAWjB,EAAsB,GAAI,IAErCkB,EAASlB,EAAsB,GAAI,IAEzC,MAAO,CAENQ,IAAKA,EACLC,WAAYA,EACZF,UAAWA,EACXI,WAAYA,EACZO,OAAQA,EACRH,QAASA,EACTH,UAAWA,EACXK,SAAUA,EACVD,OAAQA,EACRH,SAAUA,EACVC,OAAQA,EAERK,cAAeX,EAAG,KAAKG,EAAgBC,MAAAA,OACvCQ,qBAAsBZ,EAAG,KAAKG,EAAgBI,MAAAA,OAC9CM,oBAAqBb,EAAG,KAAKG,EAAgBO,MAAAA,OAC7CI,kBAAmBd,EAAG,KAAKG,EAAgBE,MAAAA,OAC3CU,wBAAyBf,EAAG,KAAKG,EAAgBG,MAAAA,OACjDU,wBAAyBhB,EAAG,KAAKG,EAAgBK,MAAAA,OAEjDS,eAAgBhB,EAAU,KAAKE,EAAgBC,MAAAA,OAC/Cc,kBAAmBjB,EAAU,KAAKE,EAAgBM,MAAAA,OAClDU,mBAAoBlB,EAAU,KAAKE,EAAgBE,MAAAA,OACnDe,qBAAsBnB,EAAU,KAAKE,EAAgBG,MAAAA,OAErDe,eAAgBtB,EAAS,KAAKI,EAAgBC,MAAAA,OAC9CkB,kBAAmBvB,EAAS,KAAKI,EAAgBM,MAAAA,OACjDc,mBAAoBxB,EAAS,KAAKI,EAAgBE,MAAAA,OAClDmB,qBAAsBzB,EAAS,KAAKI,EAAgBG,MAAAA,EACrD,KACA"} \ No newline at end of file diff --git a/dist/chromagen.umd.js b/dist/chromagen.umd.js new file mode 100644 index 0000000..d71e894 --- /dev/null +++ b/dist/chromagen.umd.js @@ -0,0 +1,2 @@ +!function(l,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(l||self).chromagen=e()}(this,function(){var l=function(l,e){return Math.floor(Math.random()*(e-l+1))+l};return function(){var e,h=l(1,359),s=h>180?h-180:h+179;switch(h){case h<135:e=h+224;break;case h>224:e=h-223;break;default:var a=h+225;e=a>359?a-359:a}var r=l(80,100),n=l(64,80),o=l(0,24),t=o<8?16:0,d=n>76?68:84,i=l(28,36),u=l(48,64),f=l(84,92);return{hue:h,complement:s,analogous:e,saturation:r,xlight:f,lighter:d,lightness:n,midrange:u,lowmid:i,darkness:o,darker:t,huehsl:"hsl("+h+", "+r+"%, "+n+"%)",huehsllighter:"hsl("+h+", "+r+"%, "+d+"%)",huehslxlight:"hsl("+h+", "+r+"%, "+f+"%)",darkhuehsl:"hsl("+h+", "+r+"%, "+o+"%)",darkhuehsldarker:"hsl("+h+", "+r+"%, "+t+"%)",darkhuehsllowmid:"hsl("+h+", "+r+"%, "+i+"%)",comphsl:"hsl("+s+", "+r+"%, "+n+"%)",comphslmid:"hsl("+s+", "+r+"%, "+u+"%)",comphsldark:"hsl("+s+", "+r+"%, "+o+"%)",comphsldarker:"hsl("+s+", "+r+"%, "+t+"%)",analhsl:"hsl("+e+", "+r+"%, "+n+"%)",analhslmid:"hsl("+e+", "+r+"%, "+u+"%)",analhsldark:"hsl("+e+", "+r+"%, "+o+"%)",analhsldarker:"hsl("+e+", "+r+"%, "+t+"%)"}}}); +//# sourceMappingURL=chromagen.umd.js.map diff --git a/dist/chromagen.umd.js.map b/dist/chromagen.umd.js.map new file mode 100644 index 0000000..573c5f0 --- /dev/null +++ b/dist/chromagen.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"chromagen.umd.js","sources":["../src/index.js"],"sourcesContent":["// Returns a random integer between min (included) and max (included)\n// Math.floor because Math.round() yields non-uniform distribution\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random\nconst getRandomIntInclusive = (min, max) => {\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n};\n\nexport default () => {\n\t// Seed the primary color\n\tconst hue = getRandomIntInclusive(1, 359);\n\t// Comment out above line and uncomment below to test specific values\n\t// var hue = 9; // 128 173 (test values)\n\n\t// Set complement (secondary) and empty analogous (tertiary) values\n\tvar complement = hue > 180 ? hue - 180 : hue + 179;\n\n\tvar analogous;\n\tswitch (hue) {\n\t\tcase hue < 135:\n\t\t\tanalogous = hue + 224;\n\t\t\tbreak;\n\t\tcase hue > 224:\n\t\t\tanalogous = hue - 223;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvar shift = hue + 225;\n\t\t\tanalogous = shift > 359 ? shift - 359 : shift;\n\t}\n\n\t// Seed random saturation and lightness within acceptable parameters for light and dark text.\n\tconst saturation = getRandomIntInclusive(80, 100);\n\t// very light or white text\n\tconst lightness = getRandomIntInclusive(64, 80);\n\t// very dark or black text\n\tconst darkness = getRandomIntInclusive(0, 24);\n\t\n\t// typically a more extreme darkness/lightness unless the value is already\n\t// extreme then a moderate value to contrast well with the extreme value\n\tlet darker = darkness < 8 ? 16 : 0;\n\tlet lighter = lightness > 76 ? 68 : 84;\n\n\t// Create other mixing values\n\n\t// dark highlight\n\tconst lowmid = getRandomIntInclusive(28, 36);\n\t// mid value used for lightness and saturation\n\tconst midrange = getRandomIntInclusive(48, 64);\n\t// highlight\n\tconst xlight = getRandomIntInclusive(84, 92);\n\n\treturn {\n\t\t// raw mixing values\n\t\thue: hue,\n\t\tcomplement: complement,\n\t\tanalogous: analogous,\n\t\tsaturation: saturation,\n\t\txlight: xlight,\n\t\tlighter: lighter,\n\t\tlightness: lightness,\n\t\tmidrange: midrange,\n\t\tlowmid: lowmid,\n\t\tdarkness: darkness,\n\t\tdarker: darker,\n\t\t// primary hue: light and dark\n\t\thuehsl: `hsl(${hue}, ${saturation}%, ${lightness}%)`,\n\t\thuehsllighter: `hsl(${hue}, ${saturation}%, ${lighter}%)`,\n\t\thuehslxlight: `hsl(${hue}, ${saturation}%, ${xlight}%)`,\n\t\tdarkhuehsl: `hsl(${hue}, ${saturation}%, ${darkness}%)`,\n\t\tdarkhuehsldarker: `hsl(${hue}, ${saturation}%, ${darker}%)`,\n\t\tdarkhuehsllowmid: `hsl(${hue}, ${saturation}%, ${lowmid}%)`,\n\t\t// complement\n\t\tcomphsl: `hsl(${complement}, ${saturation}%, ${lightness}%)`,\n\t\tcomphslmid: `hsl(${complement}, ${saturation}%, ${midrange}%)`,\n\t\tcomphsldark: `hsl(${complement}, ${saturation}%, ${darkness}%)`,\n\t\tcomphsldarker: `hsl(${complement}, ${saturation}%, ${darker}%)`,\n\t\t// analogous\n\t\tanalhsl: `hsl(${analogous}, ${saturation}%, ${lightness}%)`,\n\t\tanalhslmid: `hsl(${analogous}, ${saturation}%, ${midrange}%)`,\n\t\tanalhsldark: `hsl(${analogous}, ${saturation}%, ${darkness}%)`,\n\t\tanalhsldarker: `hsl(${analogous}, ${saturation}%, ${darker}%)`\n\t};\n};\n"],"names":["getRandomIntInclusive","min","max","Math","floor","random","analogous","hue","complement","shift","saturation","lightness","darkness","darker","lighter","lowmid","midrange","xlight","huehsl","huehsllighter","huehslxlight","darkhuehsl","darkhuehsldarker","darkhuehsllowmid","comphsl","comphslmid","comphsldark","comphsldarker","analhsl","analhslmid","analhsldark","analhsldarker"],"mappings":"4NAGA,IAAMA,EAAwB,SAACC,EAAKC,GACnC,OAAOC,KAAKC,MAAMD,KAAKE,UAAYH,EAAMD,EAAM,IAAMA,CACtD,oBAIC,IAOIK,EAPEC,EAAMP,EAAsB,EAAG,KAKjCQ,EAAaD,EAAM,IAAMA,EAAM,IAAMA,EAAM,IAG/C,OAAQA,GACP,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,QACC,IAAIE,EAAQF,EAAM,IAClBD,EAAYG,EAAQ,IAAMA,EAAQ,IAAMA,EAI1C,IAAMC,EAAaV,EAAsB,GAAI,KAEvCW,EAAYX,EAAsB,GAAI,IAEtCY,EAAWZ,EAAsB,EAAG,IAItCa,EAASD,EAAW,EAAI,GAAK,EAC7BE,EAAUH,EAAY,GAAK,GAAK,GAK9BI,EAASf,EAAsB,GAAI,IAEnCgB,EAAWhB,EAAsB,GAAI,IAErCiB,EAASjB,EAAsB,GAAI,IAEzC,MAAO,CAENO,IAAKA,EACLC,WAAYA,EACZF,UAAWA,EACXI,WAAYA,EACZO,OAAQA,EACRH,QAASA,EACTH,UAAWA,EACXK,SAAUA,EACVD,OAAQA,EACRH,SAAUA,EACVC,OAAQA,EAERK,cAAeX,EAAG,KAAKG,EAAgBC,MAAAA,OACvCQ,qBAAsBZ,EAAG,KAAKG,EAAgBI,MAAAA,OAC9CM,oBAAqBb,EAAG,KAAKG,EAAgBO,MAAAA,OAC7CI,kBAAmBd,EAAG,KAAKG,EAAgBE,MAAAA,OAC3CU,wBAAyBf,EAAG,KAAKG,EAAgBG,MAAAA,OACjDU,wBAAyBhB,EAAG,KAAKG,EAAgBK,MAAAA,OAEjDS,eAAgBhB,EAAU,KAAKE,EAAgBC,MAAAA,OAC/Cc,kBAAmBjB,EAAU,KAAKE,EAAgBM,MAAAA,OAClDU,mBAAoBlB,EAAU,KAAKE,EAAgBE,MAAAA,OACnDe,qBAAsBnB,EAAU,KAAKE,EAAgBG,MAAAA,OAErDe,eAAgBtB,EAAS,KAAKI,EAAgBC,MAAAA,OAC9CkB,kBAAmBvB,EAAS,KAAKI,EAAgBM,MAAAA,OACjDc,mBAAoBxB,EAAS,KAAKI,EAAgBE,MAAAA,OAClDmB,qBAAsBzB,EAAS,KAAKI,EAAgBG,MAAAA,EACrD,KACA"} \ No newline at end of file diff --git a/dist/hsl-gen.cjs.map b/dist/hsl-gen.cjs.map deleted file mode 100644 index 3516dc5..0000000 --- a/dist/hsl-gen.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hsl-gen.cjs","sources":["../src/index.js"],"sourcesContent":["// Returns a random integer between min (included) and max (included)\n// Math.floor because Math.round() yields non-uniform distribution\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random\nconst getRandomIntInclusive = (min, max) => {\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n};\n\nexport default () => {\n\t// Seed the primary color\n\tconst hue = getRandomIntInclusive(1, 359);\n\t// Comment out above line and uncomment below to test specific values\n\t// var hue = 9; // 128 173 (test values)\n\n\t// Set complement (secondary) and empty analogous (tertiary) values\n\tvar complement = hue > 180 ? hue - 180 : hue + 179;\n\n\tvar analogous;\n\tswitch (hue) {\n\t\tcase hue < 135:\n\t\t\tanalogous = hue + 224;\n\t\t\tbreak;\n\t\tcase hue > 224:\n\t\t\tanalogous = hue - 223;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvar shift = hue + 225;\n\t\t\tanalogous = shift > 359 ? shift - 359 : shift;\n\t}\n\n\t// Seed random saturation and lightness within acceptable parameters for light and dark text.\n\tconst saturation = getRandomIntInclusive(80, 100);\n\t// very light or white text\n\tconst lightness = getRandomIntInclusive(64, 80);\n\t// very dark or black text\n\tconst darkness = getRandomIntInclusive(0, 24);\n\t\n\t// typically a more extreme darkness/lightness unless the value is already\n\t// extreme then a moderate value to contrast well with the extreme value\n\tlet darker = darkness < 8 ? 16 : 0;\n\tlet lighter = lightness > 76 ? 68 : 84;\n\n\t// Create other mixing values\n\n\t// dark highlight\n\tconst lowmid = getRandomIntInclusive(28, 36);\n\t// mid value used for lightness and saturation\n\tconst midrange = getRandomIntInclusive(48, 64);\n\t// highlight\n\tconst xlight = getRandomIntInclusive(84, 92);\n\n\treturn {\n\t\t// raw mixing values\n\t\thue: hue,\n\t\tcomplement: complement,\n\t\tanalogous: analogous,\n\t\tsaturation: saturation,\n\t\txlight: xlight,\n\t\tlighter: lighter,\n\t\tlightness: lightness,\n\t\tmidrange: midrange,\n\t\tlowmid: lowmid,\n\t\tdarkness: darkness,\n\t\tdarker: darker,\n\t\t// primary hue: light and dark\n\t\thuehsl: `hsl(${hue}, ${saturation}%, ${lightness}%)`,\n\t\thuehsllighter: `hsl(${hue}, ${saturation}%, ${lighter}%)`,\n\t\thuehslxlight: `hsl(${hue}, ${saturation}%, ${xlight}%)`,\n\t\tdarkhuehsl: `hsl(${hue}, ${saturation}%, ${darkness}%)`,\n\t\tdarkhuehsldarker: `hsl(${hue}, ${saturation}%, ${darker}%)`,\n\t\tdarkhuehsllowmid: `hsl(${hue}, ${saturation}%, ${lowmid}%)`,\n\t\t// complement\n\t\tcomphsl: `hsl(${complement}, ${saturation}%, ${lightness}%)`,\n\t\tcomphslmid: `hsl(${complement}, ${saturation}%, ${midrange}%)`,\n\t\tcomphsldark: `hsl(${complement}, ${saturation}%, ${darkness}%)`,\n\t\tcomphsldarker: `hsl(${complement}, ${saturation}%, ${darker}%)`,\n\t\t// analogous\n\t\tanalhsl: `hsl(${analogous}, ${saturation}%, ${lightness}%)`,\n\t\tanalhslmid: `hsl(${analogous}, ${saturation}%, ${midrange}%)`,\n\t\tanalhsldark: `hsl(${analogous}, ${saturation}%, ${darkness}%)`,\n\t\tanalhsldarker: `hsl(${analogous}, ${saturation}%, ${darker}%)`\n\t};\n};\n"],"names":["getRandomIntInclusive","min","max","Math","floor","random","analogous","hue","complement","shift","saturation","lightness","darkness","darker","lighter","lowmid","midrange","xlight","huehsl","huehsllighter","huehslxlight","darkhuehsl","darkhuehsldarker","darkhuehsllowmid","comphsl","comphslmid","comphsldark","comphsldarker","analhsl","analhslmid","analhsldark","analhsldarker"],"mappings":"AAGA,IAAMA,EAAwB,SAACC,EAAKC,GACnC,OAAOC,KAAKC,MAAMD,KAAKE,UAAYH,EAAMD,EAAM,IAAMA,CACtD,4BAIC,IAOIK,EAPEC,EAAMP,EAAsB,EAAG,KAKjCQ,EAAaD,EAAM,IAAMA,EAAM,IAAMA,EAAM,IAG/C,OAAQA,GACP,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,QACC,IAAIE,EAAQF,EAAM,IAClBD,EAAYG,EAAQ,IAAMA,EAAQ,IAAMA,EAI1C,IAAMC,EAAaV,EAAsB,GAAI,KAEvCW,EAAYX,EAAsB,GAAI,IAEtCY,EAAWZ,EAAsB,EAAG,IAItCa,EAASD,EAAW,EAAI,GAAK,EAC7BE,EAAUH,EAAY,GAAK,GAAK,GAK9BI,EAASf,EAAsB,GAAI,IAEnCgB,EAAWhB,EAAsB,GAAI,IAErCiB,EAASjB,EAAsB,GAAI,IAEzC,MAAO,CAENO,IAAKA,EACLC,WAAYA,EACZF,UAAWA,EACXI,WAAYA,EACZO,OAAQA,EACRH,QAASA,EACTH,UAAWA,EACXK,SAAUA,EACVD,OAAQA,EACRH,SAAUA,EACVC,OAAQA,EAERK,cAAeX,EAAG,KAAKG,EAAgBC,MAAAA,OACvCQ,qBAAsBZ,EAAG,KAAKG,EAAgBI,MAAAA,OAC9CM,oBAAqBb,EAAG,KAAKG,EAAgBO,MAAAA,OAC7CI,kBAAmBd,EAAG,KAAKG,EAAgBE,MAAAA,OAC3CU,wBAAyBf,EAAG,KAAKG,EAAgBG,MAAAA,OACjDU,wBAAyBhB,EAAG,KAAKG,EAAgBK,MAAAA,OAEjDS,eAAgBhB,EAAU,KAAKE,EAAgBC,MAAAA,OAC/Cc,kBAAmBjB,EAAU,KAAKE,EAAgBM,MAAAA,OAClDU,mBAAoBlB,EAAU,KAAKE,EAAgBE,MAAAA,OACnDe,qBAAsBnB,EAAU,KAAKE,EAAgBG,MAAAA,OAErDe,eAAgBtB,EAAS,KAAKI,EAAgBC,MAAAA,OAC9CkB,kBAAmBvB,EAAS,KAAKI,EAAgBM,MAAAA,OACjDc,mBAAoBxB,EAAS,KAAKI,EAAgBE,MAAAA,OAClDmB,qBAAsBzB,EAAS,KAAKI,EAAgBG,MAAAA,EACrD,KACA"} \ No newline at end of file diff --git a/dist/hsl-gen.modern.js.map b/dist/hsl-gen.modern.js.map deleted file mode 100644 index eebefc6..0000000 --- a/dist/hsl-gen.modern.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hsl-gen.modern.js","sources":["../src/index.js"],"sourcesContent":["// Returns a random integer between min (included) and max (included)\n// Math.floor because Math.round() yields non-uniform distribution\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random\nconst getRandomIntInclusive = (min, max) => {\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n};\n\nexport default () => {\n\t// Seed the primary color\n\tconst hue = getRandomIntInclusive(1, 359);\n\t// Comment out above line and uncomment below to test specific values\n\t// var hue = 9; // 128 173 (test values)\n\n\t// Set complement (secondary) and empty analogous (tertiary) values\n\tvar complement = hue > 180 ? hue - 180 : hue + 179;\n\n\tvar analogous;\n\tswitch (hue) {\n\t\tcase hue < 135:\n\t\t\tanalogous = hue + 224;\n\t\t\tbreak;\n\t\tcase hue > 224:\n\t\t\tanalogous = hue - 223;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvar shift = hue + 225;\n\t\t\tanalogous = shift > 359 ? shift - 359 : shift;\n\t}\n\n\t// Seed random saturation and lightness within acceptable parameters for light and dark text.\n\tconst saturation = getRandomIntInclusive(80, 100);\n\t// very light or white text\n\tconst lightness = getRandomIntInclusive(64, 80);\n\t// very dark or black text\n\tconst darkness = getRandomIntInclusive(0, 24);\n\t\n\t// typically a more extreme darkness/lightness unless the value is already\n\t// extreme then a moderate value to contrast well with the extreme value\n\tlet darker = darkness < 8 ? 16 : 0;\n\tlet lighter = lightness > 76 ? 68 : 84;\n\n\t// Create other mixing values\n\n\t// dark highlight\n\tconst lowmid = getRandomIntInclusive(28, 36);\n\t// mid value used for lightness and saturation\n\tconst midrange = getRandomIntInclusive(48, 64);\n\t// highlight\n\tconst xlight = getRandomIntInclusive(84, 92);\n\n\treturn {\n\t\t// raw mixing values\n\t\thue: hue,\n\t\tcomplement: complement,\n\t\tanalogous: analogous,\n\t\tsaturation: saturation,\n\t\txlight: xlight,\n\t\tlighter: lighter,\n\t\tlightness: lightness,\n\t\tmidrange: midrange,\n\t\tlowmid: lowmid,\n\t\tdarkness: darkness,\n\t\tdarker: darker,\n\t\t// primary hue: light and dark\n\t\thuehsl: `hsl(${hue}, ${saturation}%, ${lightness}%)`,\n\t\thuehsllighter: `hsl(${hue}, ${saturation}%, ${lighter}%)`,\n\t\thuehslxlight: `hsl(${hue}, ${saturation}%, ${xlight}%)`,\n\t\tdarkhuehsl: `hsl(${hue}, ${saturation}%, ${darkness}%)`,\n\t\tdarkhuehsldarker: `hsl(${hue}, ${saturation}%, ${darker}%)`,\n\t\tdarkhuehsllowmid: `hsl(${hue}, ${saturation}%, ${lowmid}%)`,\n\t\t// complement\n\t\tcomphsl: `hsl(${complement}, ${saturation}%, ${lightness}%)`,\n\t\tcomphslmid: `hsl(${complement}, ${saturation}%, ${midrange}%)`,\n\t\tcomphsldark: `hsl(${complement}, ${saturation}%, ${darkness}%)`,\n\t\tcomphsldarker: `hsl(${complement}, ${saturation}%, ${darker}%)`,\n\t\t// analogous\n\t\tanalhsl: `hsl(${analogous}, ${saturation}%, ${lightness}%)`,\n\t\tanalhslmid: `hsl(${analogous}, ${saturation}%, ${midrange}%)`,\n\t\tanalhsldark: `hsl(${analogous}, ${saturation}%, ${darkness}%)`,\n\t\tanalhsldarker: `hsl(${analogous}, ${saturation}%, ${darker}%)`\n\t};\n};\n"],"names":["getRandomIntInclusive","min","max","Math","floor","random","hue","analogous","complement","shift","saturation","lightness","darkness","darker","lighter","lowmid","midrange","xlight","huehsl","huehsllighter","huehslxlight","darkhuehsl","darkhuehsldarker","darkhuehsllowmid","comphsl","comphslmid","comphsldark","comphsldarker","analhsl","analhslmid","analhsldark","analhsldarker"],"mappings":"AAGA,MAAMA,EAAwBA,CAACC,EAAKC,IAC5BC,KAAKC,MAAMD,KAAKE,UAAYH,EAAMD,EAAM,IAAMA,EAGtD,WAEC,MAAMK,EAAMN,EAAsB,EAAG,KAKrC,IAEIO,EAFAC,EAAaF,EAAM,IAAMA,EAAM,IAAMA,EAAM,IAG/C,OAAQA,GACP,KAAKA,EAAM,IACVC,EAAYD,EAAM,IAClB,MACD,KAAKA,EAAM,IACVC,EAAYD,EAAM,IAClB,MACD,QACC,IAAIG,EAAQH,EAAM,IAClBC,EAAYE,EAAQ,IAAMA,EAAQ,IAAMA,EAI1C,MAAMC,EAAaV,EAAsB,GAAI,KAEvCW,EAAYX,EAAsB,GAAI,IAEtCY,EAAWZ,EAAsB,EAAG,IAI1C,IAAIa,EAASD,EAAW,EAAI,GAAK,EAC7BE,EAAUH,EAAY,GAAK,GAAK,GAKpC,MAAMI,EAASf,EAAsB,GAAI,IAEnCgB,EAAWhB,EAAsB,GAAI,IAErCiB,EAASjB,EAAsB,GAAI,IAEzC,MAAO,CAENM,IAAKA,EACLE,WAAYA,EACZD,UAAWA,EACXG,WAAYA,EACZO,OAAQA,EACRH,QAASA,EACTH,UAAWA,EACXK,SAAUA,EACVD,OAAQA,EACRH,SAAUA,EACVC,OAAQA,EAERK,OAAS,OAAMZ,MAAQI,OAAgBC,MACvCQ,cAAgB,OAAMb,MAAQI,OAAgBI,MAC9CM,aAAe,OAAMd,MAAQI,OAAgBO,MAC7CI,WAAa,OAAMf,MAAQI,OAAgBE,MAC3CU,iBAAmB,OAAMhB,MAAQI,OAAgBG,MACjDU,iBAAmB,OAAMjB,MAAQI,OAAgBK,MAEjDS,QAAU,OAAMhB,MAAeE,OAAgBC,MAC/Cc,WAAa,OAAMjB,MAAeE,OAAgBM,MAClDU,YAAc,OAAMlB,MAAeE,OAAgBE,MACnDe,cAAgB,OAAMnB,MAAeE,OAAgBG,MAErDe,QAAU,OAAMrB,MAAcG,OAAgBC,MAC9CkB,WAAa,OAAMtB,MAAcG,OAAgBM,MACjDc,YAAc,OAAMvB,MAAcG,OAAgBE,MAClDmB,cAAgB,OAAMxB,MAAcG,OAAgBG,MAErD"} \ No newline at end of file diff --git a/dist/hsl-gen.module.js.map b/dist/hsl-gen.module.js.map deleted file mode 100644 index cd3a405..0000000 --- a/dist/hsl-gen.module.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hsl-gen.module.js","sources":["../src/index.js"],"sourcesContent":["// Returns a random integer between min (included) and max (included)\n// Math.floor because Math.round() yields non-uniform distribution\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random\nconst getRandomIntInclusive = (min, max) => {\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n};\n\nexport default () => {\n\t// Seed the primary color\n\tconst hue = getRandomIntInclusive(1, 359);\n\t// Comment out above line and uncomment below to test specific values\n\t// var hue = 9; // 128 173 (test values)\n\n\t// Set complement (secondary) and empty analogous (tertiary) values\n\tvar complement = hue > 180 ? hue - 180 : hue + 179;\n\n\tvar analogous;\n\tswitch (hue) {\n\t\tcase hue < 135:\n\t\t\tanalogous = hue + 224;\n\t\t\tbreak;\n\t\tcase hue > 224:\n\t\t\tanalogous = hue - 223;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvar shift = hue + 225;\n\t\t\tanalogous = shift > 359 ? shift - 359 : shift;\n\t}\n\n\t// Seed random saturation and lightness within acceptable parameters for light and dark text.\n\tconst saturation = getRandomIntInclusive(80, 100);\n\t// very light or white text\n\tconst lightness = getRandomIntInclusive(64, 80);\n\t// very dark or black text\n\tconst darkness = getRandomIntInclusive(0, 24);\n\t\n\t// typically a more extreme darkness/lightness unless the value is already\n\t// extreme then a moderate value to contrast well with the extreme value\n\tlet darker = darkness < 8 ? 16 : 0;\n\tlet lighter = lightness > 76 ? 68 : 84;\n\n\t// Create other mixing values\n\n\t// dark highlight\n\tconst lowmid = getRandomIntInclusive(28, 36);\n\t// mid value used for lightness and saturation\n\tconst midrange = getRandomIntInclusive(48, 64);\n\t// highlight\n\tconst xlight = getRandomIntInclusive(84, 92);\n\n\treturn {\n\t\t// raw mixing values\n\t\thue: hue,\n\t\tcomplement: complement,\n\t\tanalogous: analogous,\n\t\tsaturation: saturation,\n\t\txlight: xlight,\n\t\tlighter: lighter,\n\t\tlightness: lightness,\n\t\tmidrange: midrange,\n\t\tlowmid: lowmid,\n\t\tdarkness: darkness,\n\t\tdarker: darker,\n\t\t// primary hue: light and dark\n\t\thuehsl: `hsl(${hue}, ${saturation}%, ${lightness}%)`,\n\t\thuehsllighter: `hsl(${hue}, ${saturation}%, ${lighter}%)`,\n\t\thuehslxlight: `hsl(${hue}, ${saturation}%, ${xlight}%)`,\n\t\tdarkhuehsl: `hsl(${hue}, ${saturation}%, ${darkness}%)`,\n\t\tdarkhuehsldarker: `hsl(${hue}, ${saturation}%, ${darker}%)`,\n\t\tdarkhuehsllowmid: `hsl(${hue}, ${saturation}%, ${lowmid}%)`,\n\t\t// complement\n\t\tcomphsl: `hsl(${complement}, ${saturation}%, ${lightness}%)`,\n\t\tcomphslmid: `hsl(${complement}, ${saturation}%, ${midrange}%)`,\n\t\tcomphsldark: `hsl(${complement}, ${saturation}%, ${darkness}%)`,\n\t\tcomphsldarker: `hsl(${complement}, ${saturation}%, ${darker}%)`,\n\t\t// analogous\n\t\tanalhsl: `hsl(${analogous}, ${saturation}%, ${lightness}%)`,\n\t\tanalhslmid: `hsl(${analogous}, ${saturation}%, ${midrange}%)`,\n\t\tanalhsldark: `hsl(${analogous}, ${saturation}%, ${darkness}%)`,\n\t\tanalhsldarker: `hsl(${analogous}, ${saturation}%, ${darker}%)`\n\t};\n};\n"],"names":["getRandomIntInclusive","min","max","Math","floor","random","index","analogous","hue","complement","shift","saturation","lightness","darkness","darker","lighter","lowmid","midrange","xlight","huehsl","huehsllighter","huehslxlight","darkhuehsl","darkhuehsldarker","darkhuehsllowmid","comphsl","comphslmid","comphsldark","comphsldarker","analhsl","analhslmid","analhsldark","analhsldarker"],"mappings":"AAGA,IAAMA,EAAwB,SAACC,EAAKC,GACnC,OAAOC,KAAKC,MAAMD,KAAKE,UAAYH,EAAMD,EAAM,IAAMA,CACtD,EAEAK,aAEC,IAOIC,EAPEC,EAAMR,EAAsB,EAAG,KAKjCS,EAAaD,EAAM,IAAMA,EAAM,IAAMA,EAAM,IAG/C,OAAQA,GACP,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,QACC,IAAIE,EAAQF,EAAM,IAClBD,EAAYG,EAAQ,IAAMA,EAAQ,IAAMA,EAI1C,IAAMC,EAAaX,EAAsB,GAAI,KAEvCY,EAAYZ,EAAsB,GAAI,IAEtCa,EAAWb,EAAsB,EAAG,IAItCc,EAASD,EAAW,EAAI,GAAK,EAC7BE,EAAUH,EAAY,GAAK,GAAK,GAK9BI,EAAShB,EAAsB,GAAI,IAEnCiB,EAAWjB,EAAsB,GAAI,IAErCkB,EAASlB,EAAsB,GAAI,IAEzC,MAAO,CAENQ,IAAKA,EACLC,WAAYA,EACZF,UAAWA,EACXI,WAAYA,EACZO,OAAQA,EACRH,QAASA,EACTH,UAAWA,EACXK,SAAUA,EACVD,OAAQA,EACRH,SAAUA,EACVC,OAAQA,EAERK,cAAeX,EAAG,KAAKG,EAAgBC,MAAAA,OACvCQ,qBAAsBZ,EAAG,KAAKG,EAAgBI,MAAAA,OAC9CM,oBAAqBb,EAAG,KAAKG,EAAgBO,MAAAA,OAC7CI,kBAAmBd,EAAG,KAAKG,EAAgBE,MAAAA,OAC3CU,wBAAyBf,EAAG,KAAKG,EAAgBG,MAAAA,OACjDU,wBAAyBhB,EAAG,KAAKG,EAAgBK,MAAAA,OAEjDS,eAAgBhB,EAAU,KAAKE,EAAgBC,MAAAA,OAC/Cc,kBAAmBjB,EAAU,KAAKE,EAAgBM,MAAAA,OAClDU,mBAAoBlB,EAAU,KAAKE,EAAgBE,MAAAA,OACnDe,qBAAsBnB,EAAU,KAAKE,EAAgBG,MAAAA,OAErDe,eAAgBtB,EAAS,KAAKI,EAAgBC,MAAAA,OAC9CkB,kBAAmBvB,EAAS,KAAKI,EAAgBM,MAAAA,OACjDc,mBAAoBxB,EAAS,KAAKI,EAAgBE,MAAAA,OAClDmB,qBAAsBzB,EAAS,KAAKI,EAAgBG,MAAAA,EACrD,KACA"} \ No newline at end of file diff --git a/dist/hsl-gen.umd.js b/dist/hsl-gen.umd.js deleted file mode 100644 index df2c5d1..0000000 --- a/dist/hsl-gen.umd.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(l,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(l||self).hslGen=e()}(this,function(){var l=function(l,e){return Math.floor(Math.random()*(e-l+1))+l};return function(){var e,h=l(1,359),s=h>180?h-180:h+179;switch(h){case h<135:e=h+224;break;case h>224:e=h-223;break;default:var a=h+225;e=a>359?a-359:a}var r=l(80,100),n=l(64,80),o=l(0,24),t=o<8?16:0,d=n>76?68:84,i=l(28,36),u=l(48,64),f=l(84,92);return{hue:h,complement:s,analogous:e,saturation:r,xlight:f,lighter:d,lightness:n,midrange:u,lowmid:i,darkness:o,darker:t,huehsl:"hsl("+h+", "+r+"%, "+n+"%)",huehsllighter:"hsl("+h+", "+r+"%, "+d+"%)",huehslxlight:"hsl("+h+", "+r+"%, "+f+"%)",darkhuehsl:"hsl("+h+", "+r+"%, "+o+"%)",darkhuehsldarker:"hsl("+h+", "+r+"%, "+t+"%)",darkhuehsllowmid:"hsl("+h+", "+r+"%, "+i+"%)",comphsl:"hsl("+s+", "+r+"%, "+n+"%)",comphslmid:"hsl("+s+", "+r+"%, "+u+"%)",comphsldark:"hsl("+s+", "+r+"%, "+o+"%)",comphsldarker:"hsl("+s+", "+r+"%, "+t+"%)",analhsl:"hsl("+e+", "+r+"%, "+n+"%)",analhslmid:"hsl("+e+", "+r+"%, "+u+"%)",analhsldark:"hsl("+e+", "+r+"%, "+o+"%)",analhsldarker:"hsl("+e+", "+r+"%, "+t+"%)"}}}); -//# sourceMappingURL=hsl-gen.umd.js.map diff --git a/dist/hsl-gen.umd.js.map b/dist/hsl-gen.umd.js.map deleted file mode 100644 index 14983bb..0000000 --- a/dist/hsl-gen.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hsl-gen.umd.js","sources":["../src/index.js"],"sourcesContent":["// Returns a random integer between min (included) and max (included)\n// Math.floor because Math.round() yields non-uniform distribution\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random\nconst getRandomIntInclusive = (min, max) => {\n\treturn Math.floor(Math.random() * (max - min + 1)) + min;\n};\n\nexport default () => {\n\t// Seed the primary color\n\tconst hue = getRandomIntInclusive(1, 359);\n\t// Comment out above line and uncomment below to test specific values\n\t// var hue = 9; // 128 173 (test values)\n\n\t// Set complement (secondary) and empty analogous (tertiary) values\n\tvar complement = hue > 180 ? hue - 180 : hue + 179;\n\n\tvar analogous;\n\tswitch (hue) {\n\t\tcase hue < 135:\n\t\t\tanalogous = hue + 224;\n\t\t\tbreak;\n\t\tcase hue > 224:\n\t\t\tanalogous = hue - 223;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvar shift = hue + 225;\n\t\t\tanalogous = shift > 359 ? shift - 359 : shift;\n\t}\n\n\t// Seed random saturation and lightness within acceptable parameters for light and dark text.\n\tconst saturation = getRandomIntInclusive(80, 100);\n\t// very light or white text\n\tconst lightness = getRandomIntInclusive(64, 80);\n\t// very dark or black text\n\tconst darkness = getRandomIntInclusive(0, 24);\n\t\n\t// typically a more extreme darkness/lightness unless the value is already\n\t// extreme then a moderate value to contrast well with the extreme value\n\tlet darker = darkness < 8 ? 16 : 0;\n\tlet lighter = lightness > 76 ? 68 : 84;\n\n\t// Create other mixing values\n\n\t// dark highlight\n\tconst lowmid = getRandomIntInclusive(28, 36);\n\t// mid value used for lightness and saturation\n\tconst midrange = getRandomIntInclusive(48, 64);\n\t// highlight\n\tconst xlight = getRandomIntInclusive(84, 92);\n\n\treturn {\n\t\t// raw mixing values\n\t\thue: hue,\n\t\tcomplement: complement,\n\t\tanalogous: analogous,\n\t\tsaturation: saturation,\n\t\txlight: xlight,\n\t\tlighter: lighter,\n\t\tlightness: lightness,\n\t\tmidrange: midrange,\n\t\tlowmid: lowmid,\n\t\tdarkness: darkness,\n\t\tdarker: darker,\n\t\t// primary hue: light and dark\n\t\thuehsl: `hsl(${hue}, ${saturation}%, ${lightness}%)`,\n\t\thuehsllighter: `hsl(${hue}, ${saturation}%, ${lighter}%)`,\n\t\thuehslxlight: `hsl(${hue}, ${saturation}%, ${xlight}%)`,\n\t\tdarkhuehsl: `hsl(${hue}, ${saturation}%, ${darkness}%)`,\n\t\tdarkhuehsldarker: `hsl(${hue}, ${saturation}%, ${darker}%)`,\n\t\tdarkhuehsllowmid: `hsl(${hue}, ${saturation}%, ${lowmid}%)`,\n\t\t// complement\n\t\tcomphsl: `hsl(${complement}, ${saturation}%, ${lightness}%)`,\n\t\tcomphslmid: `hsl(${complement}, ${saturation}%, ${midrange}%)`,\n\t\tcomphsldark: `hsl(${complement}, ${saturation}%, ${darkness}%)`,\n\t\tcomphsldarker: `hsl(${complement}, ${saturation}%, ${darker}%)`,\n\t\t// analogous\n\t\tanalhsl: `hsl(${analogous}, ${saturation}%, ${lightness}%)`,\n\t\tanalhslmid: `hsl(${analogous}, ${saturation}%, ${midrange}%)`,\n\t\tanalhsldark: `hsl(${analogous}, ${saturation}%, ${darkness}%)`,\n\t\tanalhsldarker: `hsl(${analogous}, ${saturation}%, ${darker}%)`\n\t};\n};\n"],"names":["getRandomIntInclusive","min","max","Math","floor","random","analogous","hue","complement","shift","saturation","lightness","darkness","darker","lighter","lowmid","midrange","xlight","huehsl","huehsllighter","huehslxlight","darkhuehsl","darkhuehsldarker","darkhuehsllowmid","comphsl","comphslmid","comphsldark","comphsldarker","analhsl","analhslmid","analhsldark","analhsldarker"],"mappings":"yNAGA,IAAMA,EAAwB,SAACC,EAAKC,GACnC,OAAOC,KAAKC,MAAMD,KAAKE,UAAYH,EAAMD,EAAM,IAAMA,CACtD,oBAIC,IAOIK,EAPEC,EAAMP,EAAsB,EAAG,KAKjCQ,EAAaD,EAAM,IAAMA,EAAM,IAAMA,EAAM,IAG/C,OAAQA,GACP,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,KAAKA,EAAM,IACVD,EAAYC,EAAM,IAClB,MACD,QACC,IAAIE,EAAQF,EAAM,IAClBD,EAAYG,EAAQ,IAAMA,EAAQ,IAAMA,EAI1C,IAAMC,EAAaV,EAAsB,GAAI,KAEvCW,EAAYX,EAAsB,GAAI,IAEtCY,EAAWZ,EAAsB,EAAG,IAItCa,EAASD,EAAW,EAAI,GAAK,EAC7BE,EAAUH,EAAY,GAAK,GAAK,GAK9BI,EAASf,EAAsB,GAAI,IAEnCgB,EAAWhB,EAAsB,GAAI,IAErCiB,EAASjB,EAAsB,GAAI,IAEzC,MAAO,CAENO,IAAKA,EACLC,WAAYA,EACZF,UAAWA,EACXI,WAAYA,EACZO,OAAQA,EACRH,QAASA,EACTH,UAAWA,EACXK,SAAUA,EACVD,OAAQA,EACRH,SAAUA,EACVC,OAAQA,EAERK,cAAeX,EAAG,KAAKG,EAAgBC,MAAAA,OACvCQ,qBAAsBZ,EAAG,KAAKG,EAAgBI,MAAAA,OAC9CM,oBAAqBb,EAAG,KAAKG,EAAgBO,MAAAA,OAC7CI,kBAAmBd,EAAG,KAAKG,EAAgBE,MAAAA,OAC3CU,wBAAyBf,EAAG,KAAKG,EAAgBG,MAAAA,OACjDU,wBAAyBhB,EAAG,KAAKG,EAAgBK,MAAAA,OAEjDS,eAAgBhB,EAAU,KAAKE,EAAgBC,MAAAA,OAC/Cc,kBAAmBjB,EAAU,KAAKE,EAAgBM,MAAAA,OAClDU,mBAAoBlB,EAAU,KAAKE,EAAgBE,MAAAA,OACnDe,qBAAsBnB,EAAU,KAAKE,EAAgBG,MAAAA,OAErDe,eAAgBtB,EAAS,KAAKI,EAAgBC,MAAAA,OAC9CkB,kBAAmBvB,EAAS,KAAKI,EAAgBM,MAAAA,OACjDc,mBAAoBxB,EAAS,KAAKI,EAAgBE,MAAAA,OAClDmB,qBAAsBzB,EAAS,KAAKI,EAAgBG,MAAAA,EACrD,KACA"} \ No newline at end of file diff --git a/examples/browser-umd/index.html b/examples/browser-umd/index.html index c623026..51f79f5 100644 --- a/examples/browser-umd/index.html +++ b/examples/browser-umd/index.html @@ -1,5 +1,5 @@ - HSL Gen + Chromagen -

HSL Gen

+

Chromagen

💡 Supports light and dark mode.

@@ -126,7 +126,7 @@

HSL Gen

Safari · Chrome

-

UMD edition · Source code on GitHub

+

UMD edition · Source code on GitHub

Colors

Click or tap a swatch top copy the HSL value to your clipboard.

    @@ -257,10 +257,10 @@

    Colors

- + diff --git a/examples/browser/index.html b/examples/browser/index.html new file mode 100644 index 0000000..51f79f5 --- /dev/null +++ b/examples/browser/index.html @@ -0,0 +1,346 @@ + + Chromagen + + + + +

Chromagen

+ +

💡 Supports light and dark mode.

+

+ Toggle light/dark: + Firefox · + Safari · + Chrome +

+

UMD edition · Source code on GitHub

+

Colors

+

Click or tap a swatch top copy the HSL value to your clipboard.

+
    +
  • +
    + +
    primary-xlight
    +
    +
  • +
  • +
    + +
    text-color-dark
    +
    +
  • +
  • +
    + +
    background-color-light
    +
    +
  • +
  • +
    + +
    primary-lowmid
    +
    +
  • +
  • +
    + +
    background-color-dark
    +
    +
  • +
  • +
    + +
    text-color-light
    +
    +
  • +
  • +
    + +
    tertiary
    +
    +
  • +
  • +
    + +
    tertiarymid
    +
    +
  • +
  • +
    + +
    tertiarydark
    +
    +
  • +
  • +
    + +
    tertiarydarker
    +
    +
  • +
  • +
    + +
    secondary
    +
    +
  • +
  • +
    + +
    secondarymid
    +
    +
  • +
  • +
    + +
    secondarydark
    +
    +
  • +
  • +
    + +
    secondarydarker
    +
    +
  • +
+ + + + + diff --git a/examples/node-cjs.cjs b/examples/node-cjs.cjs index 8c9abb7..b1fbb38 100644 --- a/examples/node-cjs.cjs +++ b/examples/node-cjs.cjs @@ -1,3 +1,3 @@ -const hslGen = require('../dist/hsl-gen.cjs'); -const colorScheme = hslGen(); +const chromagen = require('../dist/chromagen.cjs'); +const colorScheme = chromagen(); console.log(colorScheme); diff --git a/examples/node-esm-npm.js b/examples/node-esm-npm.js index 2c55b5d..0520483 100644 --- a/examples/node-esm-npm.js +++ b/examples/node-esm-npm.js @@ -1,3 +1,3 @@ -import hslGen from '@famebot/hsl-gen'; -const colorScheme = hslGen(); +import chromagen from '@famebot/chromagen'; +const colorScheme = chromagen(); console.log(colorScheme); diff --git a/examples/node-esm.js b/examples/node-esm.js index b5035d0..8630ebc 100644 --- a/examples/node-esm.js +++ b/examples/node-esm.js @@ -1,3 +1,3 @@ -import hslGen from '../dist/hsl-gen.module.js'; -const colorScheme = hslGen(); +import chromagen from '../dist/chromagen.module.js'; +const colorScheme = chromagen(); console.log(colorScheme); diff --git a/examples/package.json b/examples/package.json index 731336a..2a45365 100644 --- a/examples/package.json +++ b/examples/package.json @@ -1,7 +1,7 @@ { - "name": "hsl-gen-example", + "name": "chromagen-example", "version": "1.0.0", - "description": "@famebot/hsl-gen example", + "description": "@famebot/chromagen example", "scripts": { "build": "echo \"noop: prebuilt\" && exit 0", "cjs": "node node-cjs.cjs", @@ -14,7 +14,7 @@ "author": "Ricky de Laveaga (https://rdela.com)", "license": "ISC", "dependencies": { - "@famebot/hsl-gen": "latest" + "@famebot/chromagen": "latest" }, "type": "module" } diff --git a/package.json b/package.json index 5ac1e8a..21f9a56 100644 --- a/package.json +++ b/package.json @@ -1,44 +1,49 @@ { - "name": "@famebot/hsl-gen", - "version": "0.6.0", - "description": "Generates a color scheme with HSL values", - "type": "module", - "source": "./src/index.js", - "exports": { - "default": "./dist/hsl-gen.modern.js", - "require": "./dist/hsl-gen.cjs" - }, - "main": "./dist/hsl-gen.cjs", - "module": "./dist/hsl-gen.module.js", - "umd:main": "./dist/hsl-gen.umd.js", - "unpkg": "./dist/hsl-gen.umd.js", - "scripts": { - "build": "microbundle", - "dev": "microbundle watch", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", - "format": "prettier --single-quote --print-width 100 --use-tabs --write src/*.js src/**/*.js", - "release": "microbundle && bumpp -x \"npm run changelog\" --all --commit --tag --push && npm publish", - "test": "mocha" - }, - "author": "Ricky de Laveaga (https://rdela.com)", - "license": "MIT", - "repository": "https://github.com/famebot/hsl-gen", - "bugs": { - "url": "https://github.com/famebot/hsl-gen/issues" - }, - "homepage": "https://github.com/famebot/hsl-gen#readme", - "keywords": [ - "hsl", - "gen", - "generate", - "color", - "scheme" - ], - "devDependencies": { - "bumpp": "^9.0.0", - "conventional-changelog-cli": "^4.0.0", - "microbundle": "^0.15.1", - "mocha": "^10.2.0", - "prettier": "^3.0.3" - } + "name": "@famebot/chromagen", + "version": "0.7.0", + "description": "Color scheme generator", + "type": "module", + "source": "./src/index.js", + "exports": { + "default": "./dist/chromagen.modern.js", + "require": "./dist/chromagen.cjs" + }, + "main": "./dist/chromagen.cjs", + "module": "./dist/chromagen.module.js", + "umd:main": "./dist/chromagen.umd.js", + "unpkg": "./dist/chromagen.umd.js", + "scripts": { + "build": "microbundle", + "dev": "microbundle watch", + "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", + "format": "prettier --single-quote --print-width 100 --use-tabs --write src/*.js src/**/*.js", + "release": "microbundle && bumpp -x \"npm run changelog\" --all --commit --tag --push && npm publish", + "test": "mocha" + }, + "author": "Ricky de Laveaga (https://rdela.com)", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/famebot/chromagen.git" + }, + "bugs": { + "url": "https://github.com/famebot/chromagen/issues" + }, + "homepage": "https://github.com/famebot/chromagen#readme", + "keywords": [ + "chroma", + "chromagen", + "hsl", + "gen", + "generate", + "color", + "scheme" + ], + "devDependencies": { + "bumpp": "^9.2.0", + "conventional-changelog-cli": "^4.0.0", + "microbundle": "^0.15.1", + "mocha": "^10.2.0", + "prettier": "^3.0.3" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2c6d16a..670522a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1637,7 +1637,7 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.21.5 - caniuse-lite: 1.0.30001469 + caniuse-lite: 1.0.30001549 fraction.js: 4.2.0 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -1757,7 +1757,7 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001469 + caniuse-lite: 1.0.30001549 electron-to-chromium: 1.4.338 node-releases: 2.0.10 update-browserslist-db: 1.0.10(browserslist@4.21.5) @@ -1835,13 +1835,13 @@ packages: resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} dependencies: browserslist: 4.21.5 - caniuse-lite: 1.0.30001469 + caniuse-lite: 1.0.30001549 lodash.memoize: 4.1.2 lodash.uniq: 4.5.0 dev: true - /caniuse-lite@1.0.30001469: - resolution: {integrity: sha512-Rcp7221ScNqQPP3W+lVOYDyjdR6dC+neEQCttoNr5bAyz54AboB4iwpnWgyi8P4YUsPybVzT4LgWiBbI3drL4g==} + /caniuse-lite@1.0.30001549: + resolution: {integrity: sha512-qRp48dPYSCYaP+KurZLhDYdVE+yEyht/3NlmcJgVQ2VMGt6JL36ndQ/7rgspdZsJuxDPFIo/OzBT2+GmIJ53BA==} dev: true /chalk@1.1.3: @@ -1884,7 +1884,7 @@ packages: normalize-path: 3.0.0 readdirp: 3.6.0 optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /chownr@2.0.0: @@ -2564,8 +2564,8 @@ packages: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] requiresBuild: true @@ -4315,7 +4315,7 @@ packages: engines: {node: '>=10.0.0'} hasBin: true optionalDependencies: - fsevents: 2.3.2 + fsevents: 2.3.3 dev: true /run-parallel@1.2.0: diff --git a/test/HSLGen.js b/test/HSLGen.js deleted file mode 100644 index b76420d..0000000 --- a/test/HSLGen.js +++ /dev/null @@ -1,12 +0,0 @@ -import hslGen from '../src/index.js'; -import assert from 'assert'; - -const propCount = 25; -const colorScheme = hslGen(); -console.log(colorScheme); - -describe('HSL Gen', () => { - it(`should return a color scheme object with ${propCount} properties`, () => { - assert.equal(Object.keys(colorScheme).length, propCount); - }); -}); diff --git a/test/chromagen.js b/test/chromagen.js new file mode 100644 index 0000000..9009d75 --- /dev/null +++ b/test/chromagen.js @@ -0,0 +1,12 @@ +import chromagen from '../src/index.js'; +import assert from 'assert'; + +const propCount = 25; +const colorScheme = chromagen(); +console.log(colorScheme); + +describe('Chromagen', () => { + it(`should return a color scheme object with ${propCount} properties`, () => { + assert.equal(Object.keys(colorScheme).length, propCount); + }); +});