Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is it possible to return the Color Picker label value?
I bet you could using one or more of the DataTypeService. However you'll then be hitting the database, so if you're looking to do this on a page view I would find another route.
Martin, peace be upon those who follow guidance.
I was able to get the label of selected value by using the following code.
@using ContentModels = Umbraco.Web.PublishedContentModels;
Layout = null;
var hexColor = Umbraco.Field("themeColor");
String colorLabel = Model.Content.GetPropertyValue<ColorPickerValueConverter.PickedColor>("themeColor").Label;
This will work for Umbraco 8
@* Include this after @inherits Umbraco.Web.Mvc.UmbracoViewPage on your Partial View *@
@* @using Umbraco.Core.PropertyEditors.ValueConverters; *@
var Colour = "#" + Model.Value<ColorPickerValueConverter.PickedColor>("yourColorPickerProperty");
var Label = Model.Value<ColorPickerValueConverter.PickedColor>("yourColorPickerProperty").Label;
<p style="color: @Colour">
The colour is @Label
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted