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

Whitespace inconsistency between default color values and values returned by color picker in HSL format #17386

Closed
Acrophost opened this issue Nov 4, 2024 · 1 comment · Fixed by #17574
Assignees
Labels
support:2 An issue reported by a commercially licensed client. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@Acrophost
Copy link

📝 Provide detailed reproduction steps (if any)

  1. Open a demo which has changable color with color picker and default color values, e.g. https://ckeditor.com/docs/ckeditor5/latest/features/tables/tables-styling.html#demo
  2. Change a color with default values. Here for example, we change cell background color to red.
  3. Change color with color picker.

✔️ Expected result

The format of a color of default color values (ones unchanged by users) should be consistent with the one obtained from color picker.

❌ Actual result

Color picker adds whitespaces inside the HSL brackets, while those are not there in case of default value colors (unless set otherwise), e.g. we get a hsl(0, 75%, 60%) value while picking red from default colors (in editor shown as red, but upon inspecting inline styles we have the hsl format) and hsl( 207, 83%, 32% ) from color picker.
Image

📃 Other details

  • Browser: All
  • OS: Any

This works like this for any place with default color/color picker, including font color, font background color, table cell background color, table cell border color, table border color, table background color.


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@Acrophost Acrophost added the type:bug This issue reports a buggy (incorrect) behavior. label Nov 4, 2024
@aldonace-wu aldonace-wu added the support:2 An issue reported by a commercially licensed client. label Nov 4, 2024
@mmotyczynska
Copy link
Contributor

It may just be a matter of removing some extra spaces here:

function formatColorOutput( values: FormatTableColor, format: ColorPickerOutputFormat ): string {
switch ( format ) {
case 'hex': return `#${ values }`;
case 'rgb': return `rgb( ${ values[ 0 ] }, ${ values[ 1 ] }, ${ values[ 2 ] } )`;
case 'hsl': return `hsl( ${ values[ 0 ] }, ${ values[ 1 ] }%, ${ values[ 2 ] }% )`;
case 'hwb': return `hwb( ${ values[ 0 ] }, ${ values[ 1 ] }, ${ values[ 2 ] } )`;
case 'lab': return `lab( ${ values[ 0 ] }% ${ values[ 1 ] } ${ values[ 2 ] } )`;
case 'lch': return `lch( ${ values[ 0 ] }% ${ values[ 1 ] } ${ values[ 2 ] } )`;
default: return '';
}
}

@Mati365 Mati365 self-assigned this Nov 26, 2024
@CKEditorBot CKEditorBot added the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Dec 2, 2024
@Mati365 Mati365 closed this as completed in e639cb6 Dec 3, 2024
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Dec 3, 2024
@CKEditorBot CKEditorBot added this to the iteration 81 milestone Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support:2 An issue reported by a commercially licensed client. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants