file-icons / atom

Atom file-specific icons for improved visual grepping.
MIT License
1.31k stars 251 forks source link

Wrong classname when I use matchName Api to get the icon classname of txt file #865

Closed Jocs closed 2 years ago

Jocs commented 2 years ago

I have a txt file, for example mock.txt through matchName api to get the icon's classname, which is icon-file-text, but I did not find the corresponding classname(icon-file-text) in styles/icons.less file.

Did I go wrong?

https://github.com/file-icons/atom/blob/5e56b79380e7d8563b9f90da461a7947b802f03e/lib/icons/.icondb.js#L1192

Alhadis commented 2 years ago

A handful of icons are provided by Atom's core styling. The ones used by File-Icons are:

Here's the equivalent CSS, if you need it outside of Atom:

.icon-circuit-board::before { content: "\f0d6"; font: 16px/1 "Octicons Regular"; }
.icon-file-pdf::before      { content: "\f014"; font: 16px/1 "Octicons Regular"; }
.icon-file-text::before     { content: "\f011"; font: 16px/1 "Octicons Regular"; }
.icon-mail::before          { content: "\f03b"; font: 16px/1 "Octicons Regular"; }
.icon-paintcan::before      { content: "\f0d1"; font: 16px/1 "Octicons Regular"; }
.icon-star::before          { content: "\f02a"; font: 16px/1 "Octicons Regular"; }

This inconsistency is annoying, but it's for backwards (and forwards) compatibility. Basically, any class-name prefixed by icon- is guaranteed not to be defined by File-Icons, which uses the -icon suffix instead.

Jocs commented 2 years ago

@Alhadis Thanks!