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 |
Beta Was this translation helpful? Give feedback.
-
@mauroerta Using a unique class called
or in this alternatives way:
|
Beta Was this translation helpful? Give feedback.
-
I'm closing this discussion since this feature was actually been implemented in latest release |
Beta Was this translation helpful? Give feedback.
-
Problem
Morfeo is based in 2 singletons,
theme
andparsers
, 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
morfeo
that exposes only 5 methods:add
to add a new theme with a given name (for example "light" or "dark")use
to use one of the previously added themesset
same as theme.setget
same as theme.getresolve
same as parsers.resolveWith this solution, the new singleton
morfeo
will have an easy way to handle multi-theming and, most importantly, will expose only the API that 99% of the time we need;theme
andparsers
singletons 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
parsers
andtheme
singletons completely, but I think the interface of the resulted singleton will expose too many API and it will be hard to use properly.Beta Was this translation helpful? Give feedback.
All reactions