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

Why does baseTriad[4] work? This is out of bounds. #121

Open
KlausHans opened this issue Dec 10, 2020 · 2 comments
Open

Why does baseTriad[4] work? This is out of bounds. #121

KlausHans opened this issue Dec 10, 2020 · 2 comments

Comments

@KlausHans
Copy link

KlausHans commented Dec 10, 2020

In ColorGeneratorCtrl.js is the following code for the constantin algorithm:

var baseTriad = tinycolor(hex).tetrad();
[...]
getColorObject(tinycolor.mix(baseDark, baseTriad[4], 15).saturate(80).lighten(65), 'A100'),
getColorObject(tinycolor.mix(baseDark, baseTriad[4], 15).saturate(80).lighten(55), 'A200'),
getColorObject(tinycolor.mix(baseDark, baseTriad[4], 15).saturate(100).lighten(45), 'A400'),
getColorObject(tinycolor.mix(baseDark, baseTriad[4], 15).saturate(100).lighten(40), 'A700')

baseTriad is an array with a length of 4, so index 4 should not exist, only 0 to 3.
I've played around here:
https://stackblitz.com/edit/angular-w2jbiq?file=src%2Fapp%2Fapp.component.ts
To my surprise it actually mades a difference in comparison to e.g. baseTriad[2]. Why is that so? It looks like unintended behavior or a bug to me.
Edit: Ok, of course it's simply undefined, so the whole tetrad thing is unnecessary.

Thanks!

Off topic: The var should be named 'baseTetrad' ;)

@KlausHans
Copy link
Author

Just found #109
According to this it should be fixed, but it's not.

@micobarac
Copy link

Still an issue :(

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

2 participants