Use this sample to configure the values of the color pickers in the widget designers. With this sample, you create a widget named Colors that displays two color selectors – one with default colors, and the other with a custom-defined colors.
The name of the palette that is used for the widget selectors by default is called Default. This palette is used for the built-in widgets, such as the Section widget. Additionally, you can reuse it for other types of widgets by using the following attribute decoration:
Default
You can override it in the appsettings.json file, like in the following example:
appsettings.json
PREREQUISITES: You must set up a Sitefinity renderer application and connect it to your Sitefinity CMS application. For more information, see Install Sitefinity in ASP.NET Core mode.
NOTE: The instructions in this sample use Visual Studio 2022 and a Sitefinity renderer project named Renderer.
Under your Renderer project, you must create the following folders:
Entities
Colors
ViewComponents
Views
Shared
Components
In Visual Studio, open the Renderer application.
Renderer
Entity
Entities/Colors
ViewComponent
View
Views/Shared/Components/Color
You need to declare the custom color palette in the application settings. You need to add the declaration in section "Widgets"/"Styling"/"Colorpalettes".
"Widgets"
"Styling"
"Colorpalettes
The appsettings.json file of your Renderer application should look similar to the following:
Build your solution.
When you open your Renderer application and open the New editor, you will see the Colors widget in the widget selector. When you add the widget on your page, it displays two lines of text, colored differently. By editing the widget, you can change the colors - for the first line, you pick from the default color picker, for the second line - from the custom color picker.
This sample is available in Sitefinity’s GitHub repository. You can run and play with it. To do this, perform the following:
sitefinity-aspnetcore-mvc-samples-master/src/color-palettes
color-palettes.sln
“Sitefinity”
“Url”
color-palettes
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important