Skip to content

Further theme work #267

@crertel

Description

@crertel

As per conversation with @boydm , inspired by the good work done by #252 , we've found a way forward that's maybe a little simpler.

(this is loose paraphrasing, we'll collect better notes here as we can recall them)

We want a Scenic.Theme (probably replacing Scenic.Styles.Theme) to encapsulate settings for a given theme. Settings for a theme are things like:

  • Colors
  • Fonts
  • Font-sizes
  • Other settings that people might want to customize (tbd, so we'll want the theme container to be flexible in that regard)

A sample theme might be created something like:

hotdog_stand_theme = Theme.create(:hotdog_stand)
                     |> Theme.add_setting( :pallette, %{
                         primary: Scenic.Color.named().red,
                         secondary: Scenic.Color.named().yellow,
                     })
                    |> Theme.add_setting( :font, "comic_sans")

We want to introduce a Scenic.ViewPort.Themes module, which exposes functions for:

  • adding a theme at runtime
  • removing a theme at runtime
  • listing registered themes
  • getting a theme at runtime

We probably don't want to do a full genserver (since we can't have everybody hammering that with messages when drawing), but instead we'll probably let folks do concurrent reads on a named ETS table and then marshal mutating operations through the module API (which may touch a genserver or maybe not). This is similar to how Viewport already works, so it'll be helpful to reuse those concepts for developers.

@boydm Lemme know if this is enough to jog your memory. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions