Skip to content

Commit

Permalink
use culori instead of chroma-js
Browse files Browse the repository at this point in the history
  • Loading branch information
meodai committed Oct 13, 2024
1 parent 2d229cb commit 5465c1c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions dist/index.esm.js

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,11 @@ <h2>About</h2>
</aside>

<script src="https://cdn.jsdelivr.net/npm/@jaames/iro@5"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/2.1.1/chroma.min.js"></script>

<script src="./index.iife.js"></script>
<script>
<script type="module">
import { rgb, random, formatHex } from 'https://cdn.skypack.dev/culori';

//import ColorDescription from './index.esm.js';
const cd = new ColorDescription.default("#b40404");
const $result = document.querySelector("[data-result]");
Expand Down Expand Up @@ -351,7 +353,7 @@ <h2>About</h2>
});

function setColor(e, fromPicker) {
const value = e ? e.target.value : chroma.random().hex();
const value = e ? e.target.value : formatHex(random());
cd.color = value;
$input.value = value;
const glPercentages = cd.percentageWords("rgb");
Expand Down Expand Up @@ -407,12 +409,9 @@ <h3>CMYK Mix</h3>
cmykPercentageWords[2]
} yellow and ${cmykPercentageWords[3]} black.</p>
<br />
<!--small data-label="HSL color representation">${chroma(value).css(
"hsl",
)}</small-->
`;
document.querySelector("[data-picker]").dataset.hsl =
chroma(value).css("hsl");
'' /*chroma(value).css("hsl")*/;
$currentColor.style.backgroundColor = value;
$currentColor.style.color = cd.bestContrast;

Expand All @@ -431,7 +430,9 @@ <h3>CMYK Mix</h3>
$input.addEventListener("input", setColor);

$randomButton.addEventListener("click", (e) => {
setColor({ target: { value: chroma.random().hex() } });
setColor({ target: { value:
formatHex(random())
} });
});

document.documentElement.addEventListener("click", (e) => {
Expand Down
4 changes: 2 additions & 2 deletions dist/index.iife.js

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions src/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export default {
},
},
descriptive: ["grey"],
nouns: ["grey"],
description: [
"Grey is a color often linked with neutrality, balance, and calm. It sits between black and white on the color spectrum, giving it a muted, understated quality. When you think of grey, you might picture misty mornings, smooth stone, or the quiet stillness of a cloudy day. It's a versatile color, fitting equally well in minimalist designs or more somber settings. Grey can evoke feelings of tranquility, contemplation, and sophistication. Close your eyes and imagine grey—it might appear as a soft shadow or a subtle haze that wraps the world in a calm, muted tone.",
],
Expand All @@ -248,9 +249,6 @@ export default {
},
},
descriptive: ["almost grey"],
description: [
"Grey is a color often linked with neutrality, balance, and calm. It sits between black and white on the color spectrum, giving it a muted, understated quality. When you think of grey, you might picture misty mornings, smooth stone, or the quiet stillness of a cloudy day. It's a versatile color, fitting equally well in minimalist designs or more somber settings. Grey can evoke feelings of tranquility, contemplation, and sophistication. Close your eyes and imagine grey—it might appear as a soft shadow or a subtle haze that wraps the world in a calm, muted tone.",
],
},
{
criteria: {
Expand Down

0 comments on commit 5465c1c

Please sign in to comment.