Closed mhaack closed 2 months ago
On second thought, maybe it's better (and less magic) to have explicit, optional properties:
badgeTextColorLight
badgeBackgroundColorLight
badgeTextColorDark
badgeBackgroundColorDark
Or a mix of both?
badgeTextColor {string|string[]}
The badge text color as either a hex string or an array (light and dark hex colors)badgeBackgroundColor {string|string[]}
The badge background color as either a hex string or an array (light and dark hex colors)@dylandepass wdyt?
Or a mix of both?
badgeTextColor {string|string[]}
The badge text color as either a hex string or an array (light and dark hex colors)badgeBackgroundColor {string|string[]}
The badge background color as either a hex string or an array (light and dark hex colors)@dylandepass wdyt?
Fully explicit is better IMO. Easier to understand for developer and easier to support on our end.
@dylandepass @rofe please have a look I updated it and we have now 4 dedicated color properties. All are optional. Not sure if there is a more elegant why to overwrite the color variables of the build in css, especially for dark mode.
@rofe failing tests are not related to this PR and I see other PRs failing as well 🤷♂️
@rofe failing tests are not related to this PR and I see other PRs failing as well 🤷♂️
I know. Switch to cimg/node:20.4.0
as docker image in .circleci/config.yml. There seems to be an issue with node:current
and our test setup.
@mhaack you can merge main
into your branch to fix the tests.
Looking at the example config above, I'm wondering if we should simplify things for people who don't care about light or dark mode by adding 2 convenience properties:
badgeTextColor
badgeBackgroundColor
The rules would be:
badge*Color
s are defined, they override the sidekick default colors for both light and dark modebadge*ColorLight
or badge*ColorDark
colors are defined, they override the badge*Color
ones in the corresponding mode@dylandepass @mhaack wdyt?
@rofe We can simplify this a little and use badgeTextColor
& badgeBackgroundColor
for default aka. light mode as most people would consider light mode as the common case. So we would have
badgeTextColor
badgeBackgroundColor
badgeTextColorDark
badgeBackgroundColorDark
The rules would be:
badge*Color
are defined, they override the sidekick default colors for both light mode and dark modebadge*ColorDark
are defined, they override the badge color in dark mode only - light color will use badge*Color
if define or default@rofe @mhaack I'm wondering if we are complicating this all too much.. What about just using CSS variables and let the site change the variables as they seem fit.
--sidekick-badge-color: #fff;
--sidekick-badge-background-color: #f30;
Proposing
--sidekick
so we can keep the same naming for the new sidekick.
What about just using CSS variables and let the site change the variables as they seem fit.
How would you imagine the site doing that? Also, I think we should be careful not to override the badge colors globally, i.e. for all badges, but allow multiple badges with different colors.
How would you imagine the site doing that?
Sites can overrride in their styles.css
helix-sidekick {
--sidekick-badge-color: #f30;
}
Also, I think we should be careful not to override the badge colors globally, i.e. for all badges, but allow multiple badges with different colors.
Yeah if multiple badges with different colors is a thing (is it?) then this idea won't work.
This approach also wouldn't work in SharePoint or on any non-HTML resources. I'd stick with a plugin config based solution.
@dylandepass
What about just using CSS variables and let the site change the variables as they seem fit.
This will not work while in word. Very initially I added a sticker only via scripts.js but ended with the same chellange, word.
Will update the PR and use the simplified config names https://github.com/adobe/helix-sidekick-extension/pull/787#issuecomment-2326494824
@rofe @dylandepass we have now only
Test got updated with 3 badges: default colors, one set of colors configured and two set of colors configured to test all cases. As discussed with @rofe on Slack, for badge foo3
I currently test only the light colors as getComputedStyle(badge)
always return the active colors.
I triede to force the test chrome into dark mode with --enable-features=WebContentsForceDark
option. However this does not work fully and window.matchMedia('(prefers-color-scheme: dark)').matches;
still returns false
also other CSS for dark mode is not applied with that correctly. See screenshot:
If I put my mac into dark mode it works without any issues:
@mhaack change of plans after a review with Kilian: he would like us to be able to control the badge colors rather than letting users pick whatever they want (potentially resulting in a bad user experience). He is proposing to use a fixed set of spectrum colors.
In order to keep the sidekick plugin API forward compatible, this means we'll need to switch to predefined colors and a single badgeColor
property in the API (gray being the default if none is selected). Kilian will provide the necessary color values for both dark and light mode.
cc @dylandepass
@rofe PR got update and reworked to use the Spectrum Badge variants Standard & Non-Semantic as discussed with Killian.
Config now accepts a badgeVariant
only. With all the variant options, using an invalid variant name it will fall back to default (neutral
)
:tada: This PR is included in version 6.49.0 :tada:
The release is available on:
v6.49.0
Your semantic-release bot :package::rocket:
Related Issues
fixes: #786
Config example for plugin list