Repository navigation
Replies: 3 comments 1 reply
|
Another advantage related to this improvement is that multi-theming will be a native feature of morfeo, so even the |
0 replies
|
@mauroerta Using a unique class called
or in this alternatives way:
|
1 reply
|
I'm closing this discussion since this feature was actually been implemented in latest release |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
Morfeo is based in 2 singletons,
themeandparsers, the first is used to handle and provide the theme and the second one to parse it and generate styles. Even if it's not hard to understand this concept, most of the times the only methods we need to use of these 2 singleton are:Solution
My idea is to create another singleton
morfeothat exposes only 5 methods:addto add a new theme with a given name (for example "light" or "dark")useto use one of the previously added themessetsame as theme.setgetsame as theme.getresolvesame as parsers.resolveWith this solution, the new singleton
morfeowill have an easy way to handle multi-theming and, most importantly, will expose only the API that 99% of the time we need;themeandparserssingletons will still be available for advanced usage for example add new parsers or easily get single slices or values from the theme.Example
Alternatives
Another alternative could be merge
parsersandthemesingletons completely, but I think the interface of the resulted singleton will expose too many API and it will be hard to use properly.All reactions