scenic icon indicating copy to clipboard operation
scenic copied to clipboard

Add support for library themes

Open vacarsu opened this issue 4 years ago • 4 comments

Description

The pull request adds support for registering library themes, similar to static assets.

Themes are now registered and validated within scenic from Scenic.Themes.

Motivation and Context

Before the theme module was on Scenic.Primitive.Style.Theme, which felt like it would only be used in the context of primitives/components. However, it was imported everywhere that theme validation was needed, and had all the themes directly on that module. This means Scenic would not be able to validate custom themes that were not a map.

Also, there were times when scenic would pass around :dark, :light atoms, you had to know this ahead of time and know to validate or get the preset via Scenic.Primitive.Style.Theme. With all themes now registered through a single module, you can now fetch presets and validate any theme from Scenic.Themes.

Types of changes

  • [ ] Bug fix (a non-breaking change which fixes an issue)
  • [x] New feature (a non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Improvement/refactoring (non-breaking change that doesn't add any feature but make things better)

Todos

  • [x] implement custom themes
  • [x] implement custom validation
  • [x] implement extendable color palette

vacarsu avatar Nov 15 '21 03:11 vacarsu

Added a way to add additional keys to be validated for custom themes.

vacarsu avatar Nov 15 '21 21:11 vacarsu

With these changes we can now validate once during compile. We shouldn't need to validate in the viewport anymore. Is my thinking here correct?

vacarsu avatar Nov 15 '21 23:11 vacarsu

Love the Palettte module. lets do a call so you can walk me through the rest. Is a bit much to wrap my head around.

boydm avatar Dec 04 '21 23:12 boydm

Okay, made the changes you requested. Moved the functions with logic out of the macro, and it will now fallback to Scenic.Themes as a default if no themes config is set.

vacarsu avatar Dec 08 '21 03:12 vacarsu