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

theme: Amend utility function bgBlur to not modulate background value #485

Merged
merged 1 commit into from May 24, 2022
Merged

theme: Amend utility function bgBlur to not modulate background value #485

merged 1 commit into from May 24, 2022

Conversation

DannyNemer
Copy link
Contributor

@DannyNemer DannyNemer commented May 23, 2022

馃摑 Description

Amends the Stitches utility function bgBlur to set the passed background-color value as-is instead of appending 66 (for alpha), which only works for hex color codes.

This change enables passing other color code formats, like hsla() and rgb(), and color tokens just like the rest of NextUI. The previous implementation confuses users for why their color value does not work.

Second, the previous implementation of setting the passed color alpha to 66% is hidden from the user. If the user wants to pass a value with a particular alpha that is not 66%, she must think about the additional 66% modification happening to her color.

For example, I would like to set the background color for this blur effect to exactly hsla(0, 0%, 100%, 0.1), where I can easily tweak the alpha value. However, this color code format is incompatible with the current implementation for the reason explained above. Second, if I instead find the corresponding hex color code for this value, I can not tweak the alpha easily; and when I do, I must also account for the 66% happening in the background.

鉀筹笍 Current behavior (updates)

  1. Requires the value passed to the utility function bgBlur to be a hex color code with a leading #.
  2. Automatically applies 66% alpha the passed color code.

馃殌 New behavior

  1. Handles any color code format and color tokens, like the rest of NextUI.
  2. Does not internally apply 66% alpha to the passed color value.

馃挘 Is this a breaking change (Yes/No):

Yes. Any existing users of this utility function (which I estimate is few considering it is tricky to enable if you do not know the passed value must be a hex color code with a leading #), must append 66 to the passed value to achieve the same background as before.

Amends the Stitches utility function `bgBlur` to set the passed background-color value as-is instead of appending `66` (for alpha), which only works for hex color codes.

This change enables passing other color code formats, like `hsla()` and `rgb()`, just like the rest of NextUI. The previous implementation confuses users for why their color value does not work.

Second, the previous implementation of setting the passed color alpha to 66% is hidden from the user. If the user wants to pass a value with a particular alpha that is not 66%, she must think about the additional 66% modification happening to her color.

For example, I would like to set the background color for this blur effect to exactly `hsla(0, 0%, 100%, 0.1)`, where I can easily tweak the alpha value. However, this color code format is incompatible with the current implementation for the reason explained above. Second, if I instead find the corresponding hex color code for this value, I can not tweak the alpha easily; and when I do, I must also account for the 66% happening in the background.
@jrgarciadev jrgarciadev added this to the 馃殌 v1.0.0-beta.8 milestone May 24, 2022
@jrgarciadev jrgarciadev added the 馃挜 Type: Breaking Change This PR includes breaking changes label May 24, 2022
Copy link
Member

@jrgarciadev jrgarciadev left a comment

Choose a reason for hiding this comment

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

Hey @DannyNemer, thanks for the explanation and for solving this 馃檶馃徎

@jrgarciadev jrgarciadev changed the base branch from main to next May 24, 2022 13:04
@jrgarciadev jrgarciadev merged commit 218c5b0 into nextui-org:next May 24, 2022
@DannyNemer DannyNemer deleted the danny/bgblur branch May 24, 2022 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃挜 Type: Breaking Change This PR includes breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants