revised Themes implementation - draft #3495
Replies: 1 comment
-
This is good! The idea with the new themes is to make it easy to configure/setup a custom theme and I think this might help users to do so. I think as a first step we/I will look through the current variables so that we know what we have to work with. In general it we have three levels of variables:
Ideally with the base theme you can set the primary color only and have the rest calculated for you. As a site integrator or even diagram author you can override any of these variables. The trick is cleaning things up a bit before we start. Above all we need to keep the color variables as low as possible as dedicated diagram variables is impossible to keep track of. My aim is to, if possible, align things like with the base theme and to try git rid of diagram specific variables, sticking with base colors and the derived palette. |
Beta Was this translation helpful? Give feedback.
-
@sidharthv96 Perhaps you've already figured out how you want to revised Themes and Configurations. But just in case you haven't....
I've been thinking and playing around with Themes a bit. Here are my thoughts so far:
Themes (draft)
Themes describe the look and feel of the diagrams produced by mermaid. This includes colors, fonts,
line thicknesses, etc. Each theme has a name and a list of settings that provide the information mermaid needs to display
diagrams.
Theme
The list of settings is a Map so that settings can be accessed ('looked up') efficiently and to ensure that settings are not duplicated.
The keys in the Map are the names of the setting and the values are the ThemeSettings.
Map<string, ThemeSetting>
When a new theme is instantiated, if it is given no settings, it will use the settings from the DefaultThemeSettingsFactory. This way, the minimal list of settings is always defined.
Serialization
A theme can be read in from and written out to JSON. This is how they can be saved, duplicated, changed, and imported.
(Will make it possible for users to easily define their own themes.)
Adding, Deleting, or Changing Setting Values
A setting value can be changed by overriding it.
When a setting value is changed, a setting is added, or a setting is deleted, the theme will update any calculated settings.
ThemeSetting
ThemeColor
Questions / Issues / Discussion
Configuration
A Configuration is conceptually similar (though will have important differences).
Seems like it would be easier to implement Themes first, both because they have less potential to break the system and to learn what works best (both implementation and for end-user documentation).
Beta Was this translation helpful? Give feedback.
All reactions