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

rgb2hsl方法,有一处写错了 #1

Open
jhygreatbug opened this issue Jun 6, 2018 · 1 comment
Open

rgb2hsl方法,有一处写错了 #1

jhygreatbug opened this issue Jun 6, 2018 · 1 comment

Comments

@jhygreatbug
Copy link

第98行,计算s的第三个if,应该改成(max - min) / (2 - (max + min)),参考wiki

		//计算s
		if ( l == 0 || max == min ) {
			s = 0;
		}else if ( 0 < l && l <= 0.5 ) {
			s = ( max - min ) / ( max + min );
		}else if ( l > 0.5 ) {
			s = ( max - min ) / ( 2 - ( max - min ) ); // 这里有误
		};
@Gavin-YYC
Copy link
Owner

多谢指出,代码已修改,这是三年前的练手项目了,之后也没太关注过

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