Unplanned
Last Updated: 16 Oct 2024 08:10 by ADMIN
David
Created on: 03 Feb 2023 12:03
Category: ColorPicker
Type: Feature Request
1
Eyedropper functionality request for colour picker

When my company's users create a new "customer site" they upload the customer's logo and then choose some colours that will form the basis of theming for the customer's site.  In that way, a customer will 'feel' like they have their own branded experience when using 'their' website.

The colours are inevitably based on the customer's logo.  To use the colour picker component, I have to train my users to go to Paint, load the logo, choose the colour using the colour picker, go into the palette and 'copy the crazy 6-digit numbers that may contain letters of the alphabet that starts with a #' and paste that into the colour picker of our web site.

Rather, I would prefer if they could simply use an eyedropper from the ColorPicker component using functionality similar to https://imagecolorpicker.com/en  It would save training and greatly improve the useability of my website.

Can I put that forward as being a feature request?

Thanks

Dave A

 

4 comments
ADMIN
Alexander
Posted on: 16 Oct 2024 08:10

Hi,

If you wish to seek guidance for the Telerik UI for Blazor suite, I strongly advocate opening a separate support ticket, forum post or public in that realm. Our expertise revolves around the Telerik UI for ASP.NET Core components. 

In addition, I also have noticed that there is no license associated for your account which limits our support service overall. You can see our available support plans in the following section:

Support Plans

Kind Regards,
Alexander
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

call
Posted on: 10 Oct 2024 10:21
call
Posted on: 10 Oct 2024 10:20

use telerik  blazor

@using Telerik.Blazor

<TelerikColorPicker @bind-Value="SelectedColor" Buttons="true">
</TelerikColorPicker>

<p>Selected color: @SelectedColor</p>

@code {
    public string SelectedColor { get; set; } = "#ff0000"; // Initial color
}

 

or online rgb color picker  https://hex2colorpicker.com

ADMIN
Aleksandar
Posted on: 10 Feb 2023 07:36

Hello David,

Thank you for logging this Feature Request. We will monitor the community interest in such a feature and consider it for future implementation.

Until such a feature becomes available out-of-the-box you could implement such tool using the MDN tutorial for extracting data from a canvas element and adding a custom command to the ImageEditor for example. This way the user will eb able to upload an image, and pick a color. 

 <script>

     function pick(event, canvas, ctx) {
        const bounding = canvas.getBoundingClientRect();
        const x = event.clientX - bounding.left;
        const y = event.clientY - bounding.top;
        const pixel = ctx.getImageData(x, y, 1, 1);
        const data = pixel.data;

        const rgba = `rgba(${data[0]}, ${data[1]}, ${data[2]}, ${data[3] / 255})`;

        return data
    }
        var imageEditorNS = kendo.ui.imageeditor;

        imageEditorNS.commands.GetColorImageEditorCommand = imageEditorNS.ImageEditorCommand.extend({
        exec: function () {
            var that = this,
                options = that.options,
                imageeditor = that.imageeditor,
                canvas = imageeditor.getCanvasElement(),
                ctx = imageeditor.getCurrent2dContext(),
                image = imageeditor.getCurrentImage();

            canvas.addEventListener("click", function(event){
                var data = pick(event, canvas, ctx);
                var picker = $("#colorpicker").getKendoColorPicker();
                picker.value(`rgba(${data[0]},${data[1]},${data[2]},${data[3] / 255})`);
                picker.trigger("change")
            },{once : true});
        }
        });
    </script>
<div class="demo-section wide">
    <label>Selected Color:</label>
     @(Html.Kendo().ColorPicker()
          .Name("colorpicker")
    )
    <h3>Upload image and select color:</h3>
    @(Html.Kendo().ImageEditor()
        .Name("imageEditor")
        .Height(900)
        .Toolbar(toolbar=>toolbar.Items(i=> {
            i.Add().Name("open");
            i.Add().Command("GetColorImageEditorCommand").Type("button").Text("Get Color").Icon("eyedropper");
        }))
    )
</div>

 

Here is a sample REPL demonstrating the above. Feel free to modify the example to meet your requirements.

Regards,
Aleksandar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.