Mode and Value in Color Picker Control

19 Dec 20222 minutes to read

Rendering palette at initial load

By default, the Picker area will be rendered at initial load. To render the Palette area while opening the ColorPicker pop-up, and specify the Mode property as Palette.

In the following sample, it will render the Palette at initial load.

<div class='wrap'>
    <h4>Select Color</h4>
    @Html.EJS().ColorPicker("element").Mode(Syncfusion.EJ2.Inputs.ColorPickerMode.Palette).Render()
</div>

<style>
    .wrap {
        margin: 0 auto;
        width: 300px;
        text-align: center;
    }
</style>
public ActionResult Palette()
    {
            return View();
    }

Color value

The Value property can be used to specify the color value to the ColorPicker. It supports either three or six digit hex codes. To include opacity, set the color value as four or eight digit hex code.

In the following sample, the color value sets as four digit hex code, the last digit represents the opacity value.

<div class='wrap'>
    <h4>Choose Color</h4>
    @Html.EJS().ColorPicker("element").Value("035a").ModeSwitcher(false).Render()
</div>

<style>
    .wrap {
        margin: 0 auto;
        width: 300px;
        text-align: center;
    }
</style>
public ActionResult Value()
    {
            return View();
    }

NOTE

The Value property supports hex code with or without # prefix.

NOTE

View Sample in GitHub.

See also