Umbraco.ColorPicker - Have a different color for each domain #17216
Replies: 3 comments 10 replies
-
I did something similar with domain-specific settings -- not colors, but the idea is the same. Add a settings document (no template) in the root of your site where color/subsite relationships are configured in the backoffice as pairs of color/domain-name values. Then when your widget is rendering, call a utility from the view that finds that settings document in the content tree, then loops through the configured colors trying to match the domain from the http request with the domain-name in the settings document. If, for some reason you need to look up the assigned domain bindings of the subsite nodes, you can do that using an injected umbraco IDomainService. Let me know if you need examples of any of this. |
Beta Was this translation helpful? Give feedback.
-
Data Type configuration variants :) I've never missed this, but after reading the proposal I realized that we might have a project in the near future where we'd need a different color palette depending on the root note. Not sure that this is a super common use case but I would really like to know more about how @nackler solve it? |
Beta Was this translation helpful? Give feedback.
-
@enkelmedia with V13 + Contentment you could create a Pretty Contentment DataList with a custom IDataListSource, and the trick was to use the EditorModel SendingContent notification to place the current page ID into a session variable (I know!) - then the custom IDataListSource could read the value of that ID from the session and use it to find the site the page was being created on, and read a set of brand colours on that homepage as the ones to use as the custom data list source for editors to select from... The same block can be used across multiple sites and the colour options for the editor are updated to reflect the context of the site the page is created on. But have been trying to think how to do something similar in v14+ without the EditorModel SendingContent hack.. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
Context: I have a Umbraco site (13+) that uses widgets. These widgets have a background color property.
In Umbraco, I have several sub-sites that share the same widgets, but these sub-sites have different colors.
Current Picker:
Choice of colors in the widget:
How can I distinguish the colors in relation to the sub-sites?
It might be useful to link a color to a domain, so that the color picker is different for each sub-domain.
Beta Was this translation helpful? Give feedback.
All reactions