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

Fix incorrect HSL/HSLA conversion #4633

Merged
merged 17 commits into from
Apr 22, 2021
Merged

Fix incorrect HSL/HSLA conversion #4633

merged 17 commits into from
Apr 22, 2021

Conversation

Comandeer
Copy link
Member

@Comandeer Comandeer commented Apr 20, 2021

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

All patches that change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

Did you follow the CKEditor 4 code style guide?

Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.

  • PR is consistent with the code style guide

What is the proposed changelog entry for this pull request?

* [#4597](https://github.com/ckeditor/ckeditor4/issues/4597): Fixed: incorrect color conversion for HSL/HSLA values.

What changes did you make?

Due to the issue mentioned in #4597 (comment) I've introduced additional data saved for HSL colors (hue, saturation and lightness) alongside the concept of color type.

Additionally I added rounding of lightness value and fixed the issue with saturation being always 0 or 1, due to incorrect rounding.

Which issues does your PR resolve?

Closes #4597.

Note: this PR is a bug fix, however it's targeted to major as already merged changes (#4599) introduced some tests that have incorrect values and this PR fixes it.

@Dumluregn Dumluregn self-requested a review April 21, 2021 13:39
@Dumluregn Dumluregn self-assigned this Apr 21, 2021
Copy link
Contributor

@Dumluregn Dumluregn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small fixes needed here. I like the conversion of channels container from array to object 👍🏻

core/tools/color.js Show resolved Hide resolved
core/tools/color.js Outdated Show resolved Hide resolved
core/tools/color.js Outdated Show resolved Hide resolved
core/tools/color.js Show resolved Hide resolved
core/tools/color.js Show resolved Hide resolved
tests/core/tools/color.js Outdated Show resolved Hide resolved
@Comandeer
Copy link
Member Author

Ok, I've updated API docs and slightly modified tests to also assert channels.

@Dumluregn
Copy link
Contributor

Rebased onto latest major.

Copy link
Contributor

@Dumluregn Dumluregn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉

I've only fixed tests error messages and added test case for hex code without #.

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

Successfully merging this pull request may close these issues.

Incorrect conversion of HSL/HSLA values
2 participants