block-visibility icon indicating copy to clipboard operation
block-visibility copied to clipboard

Add support for a "Color scheme" (dark mode/light mode) visibility setting

Open andersnoren opened this issue 10 months ago • 1 comments

What problem does this address?

In some cases, you might want to hide or show a block depending on whether the visitor has their system appearance settings set to dark mode or light mode.

A recent scenario I've run into is that one set of illustrations (image blocks) with black strokes should be shown to light mode visitors, and another set of illustrations with white strokes should be shown for dark mode visitors.

What is your proposed solution?

Add a "Color scheme" setting allowing you to hide blocks for either "Light mode" or "Dark mode", using prefers-color-scheme.

andersnoren avatar Apr 08 '24 08:04 andersnoren

Hi @andersnoren ,

Great idea! I made an block visibility add-on based on your suggestion. It uses the prefers-color-scheme setting to show or hide blocks depending on whether the user is in dark mode or light mode. You're welcome to try it out and see if it helps!

Stormrunn3r avatar Apr 18 '24 22:04 Stormrunn3r