Skip to content

change only icon color #444

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

Open
zhengpd opened this issue Apr 16, 2024 · 5 comments
Open

change only icon color #444

zhengpd opened this issue Apr 16, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@zhengpd
Copy link

zhengpd commented Apr 16, 2024

It would be nice if the icon can change only color with something like require"nvim-web-devicons".set_icon_color("rb", "#00ff00")

@alex-courtis
Copy link
Member

Yes, that would be useful. It seems that you would need to get first, change then set.

@alex-courtis alex-courtis added the enhancement New feature or request label Apr 16, 2024
@gegoune
Copy link
Collaborator

gegoune commented Jan 25, 2025

This should be achievable today with what Alex is suggesting. Something like:

require'nvim-web-devicons'.get_icons()['a']

or

require'nvim-web-devicons'.get_icons_by_filename()['webpack']

can be used to get icon's table which can be modified however you like and returned with https://github.com/nvim-tree/nvim-web-devicons?tab=readme-ov-file#set-an-icon.

I haven't tested it. @zhengpd Would that be sufficient for your need?

@alex-courtis Or do we want to introduce API to retrieve single icon only?

@alex-courtis
Copy link
Member

@alex-courtis Or do we want to introduce API to retrieve single icon only?

That sounds good; it's probably what should have been done instead of returning icon/higroup.

It'll need a different name; get_icon_full?

@gegoune
Copy link
Collaborator

gegoune commented Jan 25, 2025

We could unify get_icon_color() and get_icon() into new icon() returning table with all keys and deprecate old methods.

@alex-courtis
Copy link
Member

We could unify get_icon_color() and get_icon() into new icon() returning table with all keys and deprecate old methods.

That'd do it.

Honestly, I want to rewrite the thing (unifying the API) as it's complex/fragile. Needs unit tests before attempting that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants