Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bilelmoussaoui/linux-icons
Use Native Linux icons on NodeJS
https://github.com/bilelmoussaoui/linux-icons
Last synced: 3 months ago
JSON representation
Use Native Linux icons on NodeJS
- Host: GitHub
- URL: https://github.com/bilelmoussaoui/linux-icons
- Owner: bilelmoussaoui
- License: mit
- Created: 2017-06-01T00:48:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T17:29:18.000Z (about 2 years ago)
- Last Synced: 2024-04-13T23:54:14.982Z (9 months ago)
- Language: JavaScript
- Size: 454 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# linux-icons
[![Build Status](https://travis-ci.org/bil-elmoussaoui/linux-icons.svg?branch=master)](https://travis-ci.org/bil-elmoussaoui/linux-icons)
Use Native Linux icons on NodeJS
Improve Linux support on your NodeJS application by using system icon themes. The icons should be placed under one of the freedesktop icons location standards like `/usr/share/icons/hicolor/`
## Status
The current version supports:
- Inherits
- Sizes (SVG icons are resized when using `getIconBuffer`)
- Icon [Contexts](https://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#context)## How to use
Install the package
```bash
npm install --save linux-icons
```In order to get the full path of an icon
```javascript
const icons = require('linux-icons')let iconPath = icons.getIcon.sync('myicon-name', 22, icons.Context.STATUS)
```Async
```javascript
const icons = require('linux-icons')icons.getIcon('myicon-name', 22, icons.Context.STATUS, iconPath => {
console.log(iconPath)
})
```Or to get the buffer of it
```javascript
const icons = require('linux-icons')let icon = icons.getIconBuffer.sync('myicon-name', 22, icons.Context.STATUS)
```Async
```javascript
const icons = require('linux-icons')icons.getIconBuffer('myicon-name', 22, icons.Context.STATUS, buffer => {
console.log(buffer)
})
```Note: Electron tray icons does not support SVG icons. You will have to use `getIconBuffer` with `nativeImage.createFromBuffer`. See the examples folder.
## TODO
- [x] Auto-detect the DE and get the right icon theme name
- [x] Async version
- [ ] Clean the code!
- [ ] Scaling Factor