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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix luminosity by removing underscore #231

Closed
theill opened this issue Oct 28, 2021 · 0 comments
Closed

Fix luminosity by removing underscore #231

theill opened this issue Oct 28, 2021 · 0 comments
Labels

Comments

@theill
Copy link

theill commented Oct 28, 2021

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch color@4.0.1 for the project I'm working on.

I got an error when trying to call the luminosity because of the underscore. Seems to have been added by mistake?

Here is the diff that solved my problem:

diff --git a/node_modules/color/index.js b/node_modules/color/index.js
index fe8fb60..3c53107 100644
--- a/node_modules/color/index.js
+++ b/node_modules/color/index.js
@@ -251,10 +251,10 @@ Color.prototype = {
 		// http://www.w3.org/TR/WCAG20/#relativeluminancedef
 		const rgb = this.rgb().color;
 
-		const lum = [];
+    const lum = [];
 		for (const [i, element] of rgb.entries()) {
 			const chan = element / 255;
-			lum[i] = (chan <= 0.039_28) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
+			lum[i] = (chan <= 0.03928) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
 		}
 
 		return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];

This issue body was partially generated by patch-package.

@Qix- Qix- closed this as completed Oct 28, 2021
Repository owner locked as spam and limited conversation to collaborators Oct 28, 2021
@Qix- Qix- added the wontfix label Oct 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants