Lightning-UI-Components icon indicating copy to clipboard operation
Lightning-UI-Components copied to clipboard

fix(Colors): enable [token, newAlpha] format

Open ImCoolNowRight opened this issue 1 year ago • 1 comments

Description

Enables users to set colors using the format [colorToken, newAlpha] so that an existing color token can be utilized and just have its alpha value overridden.

This was doable prior to #499, but was only used in a few fringe cases. This PR enables that again while maintaining the functionality added in the previous PR.

References

LUI-1592

Testing

Set the backgroundColor in Surface.styles.js to be [theme.color.interactiveNeutral, theme.alpha.alpha1]. This should no longer cause the component to render in pure white. Change the second value to theme.alpha.alpha2 and ensure it adjusts accordingly.

Checklist

  • [x] all commented code has been removed
  • [x] any new console issues have been resolved
  • [x] code linter and formatter has been run
  • [x] test coverage meets repo requirements
  • [x] PR name matches the expected semantic-commit syntax

ImCoolNowRight avatar Oct 04 '24 20:10 ImCoolNowRight

@erautenberg Regarding this change from #499 and whether it should be adjusted in this PR, I just want to make sure that you agree that we should only be allowing this format to work within style files and that there's no expectation of this ever coming from the theme and we don't need to adjust those conditionals, correct?

ImCoolNowRight avatar Oct 04 '24 20:10 ImCoolNowRight

@erautenberg Regarding this change from #499 and whether it should be adjusted in this PR, I just want to make sure that you agree that we should only be allowing this format to work within style files and that there's no expectation of this ever coming from the theme and we don't need to adjust those conditionals, correct?

Yep, I think that makes total sense. In the context of the original theme, you could always reference just the first value of another token instead of the entire thing, so there are clear workarounds from that level.

erautenberg avatar Oct 09 '24 20:10 erautenberg

:tada: This PR is included in version @lightningjs/ui-components-v2.23.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: