Giter Club home page Giter Club logo

atom-1's Introduction

File Icons

File-specific icons in Atom for improved visual grepping.

Icon previews

Supports the following packages:

Installation

Open SettingsInstall and search for file-icons.

Alternatively, install through command-line:

apm install file-icons

Customisation

Everything is handled using CSS classes. Use your stylesheet to change or tweak icons.

Consult the package stylesheets to see what classes are used:

Icon reference

Examples

  • Resize an icon:

     .html5-icon:before{
     	font-size: 18px;
     }
     
     // Resize in tab-pane only:
     .tab > .html5-icon:before{
     	font-size: 18px;
     	top: 3px;
     }
  • Choose your own shades of orange:

     .dark-orange   { color: #6a1e05; }
     .medium-orange { color: #b8743d; }
     .light-orange  { color: #cf9b67; }
  • Bring back PHP's blue-shield icon:

     .php-icon:before{
     	font-family: MFizz;
     	content: "\f147";
     }
  • Assign icons by file extension:

     .icon[data-name$=".js"]:before{
     	font-family: Devicons;
     	content: "\E64E";
     }
  • Assign icons to directories:

     .directory > .header > .icon{
     	
     	&[data-path$=".atom/packages"]:before{
     		font-family: "Octicons Regular";
     		content: "\f0c4";
     	}
     }

Troubleshooting

I see this error after installing:

"Cannot read property 'onDidChangeIcon' of undefined"

A restart is needed to complete installation. Reload the window, or restart Atom.

If this doesn't help, please file an issue.

An icon has stopped updating:
It's probably a caching issue. Do the following:

  1. Open the command palette: Cmd/Ctrl + Shift + P
  2. Run file-icons:clear-cache
  3. Reload the window, or restart Atom

The tree-view's files are borked and look like this:
If you haven't restarted Atom since upgrading to File-Icons v2, do so now.

If restarting doesn't help, your stylesheet probably needs updating. See below.

The tree-view keeps opening by itself when opening a project window:

  1. Open the dev-tools: ViewDeveloperToggle Developer Tools
  2. Click the Console tab
  3. Run the following line, then restart Atom:
atom.config.set("file-icons.revealTreeView", false);

My stylesheet has errors since updating:
As of v2.0, classes are used for displaying icons instead of mixins. Delete lines like these from your stylesheet:

-@import "packages/file-icons/styles/icons";
-@import "packages/file-icons/styles/items";
-@{pane-tab-selector},
.icon-file-directory {
	&[data-name=".git"]:before {
-		.git-icon;
+		font-family: Devicons;
+		content: "\E602";
	}
}

Instead of @pane-tab… variables, use .tab > .icon[data-path]:

-@pane-tab-selector,
-@pane-tab-temp-selector,
-@pane-tab-override {
+.tab > .icon {
 	&[data-path$=".to.file"] {
 		
 	}
}

These CSS classes are no longer used, so delete them:

-.file-icons-force-show-icons,
-.file-icons-tab-pane-icon,
-.file-icons-on-changes

It's something else.
Please file an issue. Include screenshots if necessary.

Integration with other packages

If you're a package author, you can integrate File-Icons using Atom's services API:

First, add this to your package.json file:

"consumedServices": {
	"file-icons.element-icons": {
		"versions": {
			"1.0.0": "consumeElementIcons"
		}
	}
}

Secondly, add a function named consumeElementIcons (or whatever you named it) to your package's main export:

let addIconToElement;
module.exports.consumeElementIcons = function(func){
	addIconToElement = func;
};

Then call the function it gets passed to display icons in the DOM:

let fileIcon = document.querySelector("li.file-entry > span.icon");
addIconToElement(fileIcon, "/path/to/file.txt");

The returned value is a Disposable which clears the icon from memory once it's no longer needed:

const disposable = addIconToElement(fileIcon, "/path/to/file.txt");
fileIcon.onDestroy(() => disposable.dispose());

NOTE: Remember to remove any default icon-classes before calling the service handler.

 let fileIcon = document.querySelector("li.file-entry > span.icon");
+fileIcon.classList.remove("icon-file-text");
 const disposable = addIconToElement(fileIcon, "/path/to/file.txt");

Acknowledgements

Originally based on sommerper/filetype-color, but now sporting a shiny new file-icons API in v2 thanks to Alhadis! Also thanks to all the contributors

atom-1's People

Contributors

a-b-r-o-w-n avatar abhishekdev avatar alhadis avatar avanderhoorn avatar ckross01 avatar daltones avatar dan-c-underwood avatar danbrooker avatar forcegroup avatar fusion809 avatar gontadu avatar hggeorg avatar itiut avatar jamieconnolly avatar jeremy-engel avatar johngeorgewright avatar jtarasovic avatar k4nar avatar lopezjurip avatar luke5542 avatar nicolab avatar optikfluffel avatar panickbr avatar roman01la avatar rowinbot avatar schmty avatar suranyami avatar tomasstankovic avatar williamd1k0 avatar zacblazic avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.