Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hex output should be clamped #15

Open
FossPrime opened this issue Jul 14, 2021 · 0 comments
Open

hex output should be clamped #15

FossPrime opened this issue Jul 14, 2021 · 0 comments

Comments

@FossPrime
Copy link

Currently HEX will frequently go out of the 0xFF bounds and create unparseable strings

Sandbox:
https://runkit.com/hesygolu/60ee85d2ae1a4b001af6c265

// Node.js users will need to import the module
const Color = require("ac-colors");

// capitalize: true
let primary = new Color({color: '#009fff', "type":'hex'})
const bgColArr = primary.lchuv
bgColArr[0] = 95;
bgColArr[1] = 15;
const bgCol = new Color({color: bgColArr, type: 'lchuv'})
console.log(bgCol.hex); // #e8f1ff, rgb(232, 241, 255)

Expected

That should output #e8f1ff like http://colorjs.github.io/color-space/#e8f1ff does.

Actual

#e8f1101 individual colors can overflow breaking ther order of the hex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant