Skip to content

Folder name specific colors #2369

Closed
Closed
@antoniosarosi

Description

@antoniosarosi

Is this a question?
Original Q&A: #1498

Can this functionality be implemented utilising API?
I don't think so, I haven't found any function to change the color of an icon.

Is your feature request related to a problem? Please describe.
It's not related to a problem or bug, the feature would simply allow the user to change the color of a directory icon based on its name, for example, "node_modules" = "green", "lua" = "blue", etc.

Describe the solution you'd like
Either a setup option similar to nvim-web-devicons:

require'nvim-web-devicons'.setup {
 override_by_filename = {
  [".gitignore"] = {
    icon = "",
    color = "#f1502f",
    name = "Gitignore"
  }
 };
}

Maybe something like this:

require("nvim-tree").setup({
    renderer = {
        indent_markers = {
            enable = true,
        },
        override_by_directory_name = {
            ["node_modules"] = {
                icon = "󰎙",
                color = "#68A063",
                name = "NodeModules",         
            }
        }
    }
})

Or some sort of API function that gets called with the directory name and returns the color (not sure how that would work or how it would impact performance).

Describe alternatives you've considered
I tried configuring nvim-web-devicons directly but I think you can only to that with files, not directories.

Additional context
Basically trying to simulate icon themes like Material Icon Theme for VScode:

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedQOLQuality Of Life Improvementfeature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions