Custom icons in color picker

1 Answer 513 Views
ColorPicker
Jaspreet
Top achievements
Rank 1
Iron
Veteran
Jaspreet asked on 14 Sep 2021, 09:03 AM

Hi,

In the documentation https://www.telerik.com/kendo-angular-ui/components/inputs/colorpicker/custom/ , the sample is given for customizing icons using kendo icons or kendo classes.

Is there an option of using angular material icons/class with colorpicker component. 

 

Regards,

Jaspreet

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 15 Sep 2021, 07:25 AM

Hi Jaspreet,

Yes, this is possible to be achieved. The following example demonstrates the two options to customize the ColorPicker icon:

https://www.telerik.com/kendo-angular-ui/components/inputs/colorpicker/custom/#toc-display-an-icon-in-the-colorpicker

The icon option allows the usage of Kendo UI icons. It receives the name of the icon and the component will build the required CSS classes automatically.

The iconClass option on the other hand receives any custom CSS classes and applies them 1:1 as they are passed. It could be used to render any custom icon. Depending on the icon specifics (size, positioning etc.) some additional custom styling might be needed.

I hope this information helps.

Regards,
Dimiter Madjarov
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.

Jaspreet
Top achievements
Rank 1
Iron
Veteran
commented on 17 Sep 2021, 05:46 AM | edited

Hi Dimiter,

Actually we have tried both the options https://stackblitz.com/edit/angular-39unsh but none worked with angular material icons. The class and icons it picks are only from kendo.

Angular material icon used from https://fonts.google.com/icons?selected=Material+Icons:drag_indicator&icon.query=color in 4th example in stackblitz link shared. 

Regards,

Jaspreet

Jaspreet
Top achievements
Rank 1
commented on 24 Sep 2021, 02:02 PM

Hi Dimiter,

Kindly provide some inputs to handle this scenario.

Regards,

Jaspreet

Martin Bechev
Telerik team
commented on 27 Sep 2021, 08:47 AM

Hi Jaspreet,

Here is an example of a Kendo Angular ColorPicker component with [icon] property set to an icon from the list:

https://stackblitz.com/edit/angular-hdqqkw-sgfohv

And an example that utilizes [iconClass], using Material icon:

https://stackblitz.com/edit/angular-hdqqkw

The codepoint for the icon was copied from the following GitHub issue comment:

https://github.com/google/material-design-icons/issues/813#issuecomment-401601344

but can be found also here:

https://github.com/google/material-design-icons/tree/master/font

Regards,

Martin

Jaspreet
Top achievements
Rank 1
commented on 27 Sep 2021, 10:23 AM

Thank you Martin for the reply. There is still one issue that the selected color does not reflect on the icon. Though it works fine with kendo icons. 

 

Regards,

Jaspreet

 

Martin Bechev
Telerik team
commented on 27 Sep 2021, 10:44 AM

Hi Jaspreet,

The used material icon in the afore-mentioned demo does not reflect selected colors by default:

But the developer can set the color of the icon, by setting the color CSS property in the custom class

.custom-icon::before {
        content: "\\e23a";
        font-family: 'Material Icons';
        color: #548235;
      }

Regards,
Martin
Progress Telerik
Tags
ColorPicker
Asked by
Jaspreet
Top achievements
Rank 1
Iron
Veteran
Answers by
Dimiter Madjarov
Telerik team
Share this question
or