Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request(feature:color-picker) Customizable selected color icon #129

Closed
motabass opened this issue Jun 30, 2020 · 7 comments
Closed

request(feature:color-picker) Customizable selected color icon #129

motabass opened this issue Jun 30, 2020 · 7 comments
Assignees
Labels
comp: color-picker request: feature Community request new feature
Milestone

Comments

@motabass
Copy link
Contributor

motabass commented Jun 30, 2020

There should be a way to use color-picker without material-icon-font loaded
Because in our Project we do not use the Material-Icon-Font due to only using SVGs for icons it would be great if we could change the icon shown on the currently selected color in the picker to any other mat-icon using an SVG. Rigth now material icon "done" is used but shows up as "done"-text when material-icon-font is not loaded.
image

@tiaguinho tiaguinho self-assigned this Jun 30, 2020
@tiaguinho tiaguinho added comp: color-picker request: feature Community request new feature labels Jun 30, 2020
@tiaguinho tiaguinho added this to the v6.2.0 milestone Jul 2, 2020
@tiaguinho
Copy link
Owner

Hi @motabass
As you can see on the related commit, I implement a way to change the selected color icon.
On #133 I also implement an option to disable the selected icon.

Let me know if this solve your problem.

@motabass
Copy link
Contributor Author

motabass commented Jul 10, 2020

Hi @tiaguinho

Thanks for your work. This solves our Problem by being able to disable the icon. Though it would be awesome if we could use any SVG registered in MatIconRegistry, not only Material-Font-Icons because we don't use the Material-Font at all. It should be pretty easy to implement it the same way as SELECTED_COLOR_ICON. Could be SELECTED_COLOR_SVG_ICON

@tiaguinho
Copy link
Owner

You can register SVG in MatIconRegistry https://material.angular.io/components/icon/overview#svg-icons.
If you do this, you can use the icon as SELECTED_COLOR_ICON.

You can test this possibility by cloning the repository and trying on the demo app.

Can you make this test?

Thank you.

@motabass
Copy link
Contributor Author

motabass commented Jul 10, 2020

I think it should not work with SVGs the way its implemented right now. Check the SVG example here: https://material.angular.io/components/icon/examples

mat-icon uses svgIcon-Input for SVG. Font ligatures only work with icon fonts as stated here:
https://material.angular.io/components/icon/api#MatIcon

So it would have to be
<mat-icon *ngIf="selectedColor === color; else emptyIcon" [svgIcon]="selectedIcon"></mat-icon>
to work...which would in turn not work with Font-Ligatures. Thats why there is a need for a Seperate flag i think.

I'm not much of a fan of the mat-icon API but thats the way they decided to do it.

@motabass
Copy link
Contributor Author

motabass commented Jul 17, 2020

Are you looking into this or should i maybe open a new Issue for the SVG-Feature?

@tiaguinho
Copy link
Owner

Please open a new issue.
I'll try to implement this feature today. 😉

@motabass
Copy link
Contributor Author

Thats great! I opened the Issue:

#134

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: color-picker request: feature Community request new feature
Projects
None yet
Development

No branches or pull requests

2 participants