-
Notifications
You must be signed in to change notification settings - Fork 841
New page: color modules example #125
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a first pass. We also need to run Prettify on this file; I'll do a last pass afterward (it is difficult to read like this).
Unless you know why, you should always use ===
instead of ==
and textContent
instead of innerHTML
if there is no HTML involve.
I added |
@teoli2003 We went with function hexOpacity(color, opacity) {
let char = "00";
if (opacity > 0) {
char = Math.floor(opacity * 255).toString(16);
}
return `${color}${char}`;
} Is it also ok to go with the following way of declaring a function (the first line), or against our best practices guidelines? const hexOpacity = (color, opacity) => {
let char = "00";
if (opacity > 0) {
char = Math.floor(opacity * 255).toString(16);
}
return `${color}${char}`;
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few last small changes, but I find this much easier to read already!
When possible, I prefer to have a (I'm not a fan of setting the else value before the if, but that's not against our rules and a matter of taste) |
Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com>
Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Example for new CSS color module page.