argyleink / open-props

CSS custom properties to help accelerate adaptive and consistent design.
https://open-props.style
MIT License
4.78k stars 193 forks source link

Buttons do not respect dark/light switch #342

Closed GeorgEchterling closed 1 year ago

GeorgEchterling commented 1 year ago

Buttons currently only support the user agent's preferred color scheme. They should also support the recently added theme toggling.

argyleink commented 1 year ago

confirmed. ty for logging, will get on it!

GeorgEchterling commented 1 year ago

I looked into it some more and it looks like only two lines in buttons.css need to be changed.

argyleink commented 1 year ago

i fixed it in my local demo by reordering my imports:

HAS BUG:

@import 'open-props/style';
@import 'open-props/normalize';
@import 'open-props/switch/light';
@import 'open-props/switch/dark';
@import 'open-props/buttons';

FIXED:

@import 'open-props/style';
@import 'open-props/normalize';
@import 'open-props/buttons';
@import 'open-props/switch/light';
@import 'open-props/switch/dark';

This way the overrides from the switch style win based on cascade. gonna close this assuming it fixes your issue too. lemme know!

GeorgEchterling commented 1 year ago

This doesn't quite fix my issue. Looks like my issue is more specific than what I initially described:

I don't know if the theme switch is intended to be used in this way. Maybe it was only intended for the root element?

argyleink commented 1 year ago

yeah, def intended for root propagating all the way throughout. BUT!

you could just reach in and write a button color to fix this? (maybe you've already done that) you shouldnt need to battle Open Props styles, they're wrapped in :where(), so hopefully it's easy to patch for your use case? 🙂