keepthatworktoyourself / wombat

Not another website builder. Public repo — raise issues, request features, get help.
2 stars 0 forks source link

Theme Architecture: Switching #319

Open pjrundle opened 6 months ago

pjrundle commented 6 months ago

🪨 Static theme settings tokens

Most elements of a theme settings object are "static" tokens. I.e:

These tokens are consistent and present across all/any theme settings object, so we can rely on them being there when switching between themes.

👩‍🎨 Dynamic theme settings tokens

However, recently I’ve been experimenting with "dynamic" theme tokens.

For instance, theme A might have/need two brand colors, whereas theme B might need 5/whatever brand colors.

Theme A might need gradients, theme B might not.

An example of where this currently problematic: You've built a page, and some of the blocks are using a color/gradient from theme A. When you switch the theme B, these values do not exist.


Solution 1 - Only static tokens

Pros:

Cons:

Solution 2 - Gracefully handle non-existent tokens - flag non existent tokens

Pros:

Cons:

Solution 2.5 - Gracefully handle non-existent tokens - fallback to defaults

Solution 3 - Theme specific block settings

Pros:

Cons:

Solution 4 - One theme per site


💡 Thought immediately after writing this. Unless we make switching themes genuinely useful/powerful, then is having switchable themes actually useful?


Some possible utilities of switching themes

bhallstein commented 6 months ago

Solution 2 - Gracefully handle non-existent tokens - flag non existent tokens

  • flag in the block builder UI that XYZ token does not exist for theme B.
  • web block (for example) background color will be "unset" (className/style has no value)

Or perhaps set to a grayscale 'stub' color/gradient. (or a spectacularly lurid one? see clearcolor in video games)

I can imagine in the theme editor in the colour token panel we could display to the user all the tokens currently in use on the site that do not have values as a kind of 'unset color' control, and let them set one. This could provide an efficient workflow for making a new theme and quickly building out the set of required tokens for that theme based on the tokens that exist in the current site.

(this is sort of like a solution 2.6 🤣)

bhallstein commented 6 months ago

Solution 4 - One theme per site

IMO they need multiple themes so they can experiment and most of all have the freedom to screw up. I still see the decoupling of content from design as a core tenet for Wom.

bhallstein commented 6 months ago

Solution 3 - Theme specific block settings

For me the main question mark over this is whether there a UX solution is even possible that does "for this block, if the theme is X, use these settings, if Y, use these other settings, if other, fall back to original settings"*. I do have some ideas, be interesting to talk over/sketch some ideas. Also interested if we can point to anything like this type of UI problem exists in any other problem domain, however remotely similar.

* (and also, in this other non dynamic property mode, don't do any of this 🤣)

what happens when you duplicate a theme? does this mean we need parent/child relationship for themes to address the above?

Lots to think through on this on a technical level as previously discussed, but in general my feeling is a parent-child relationship would be a coding nightmare.

bhallstein commented 6 months ago

Related: #112 (brand-versioned assets)