Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greendelta/swt-material-icons
https://github.com/greendelta/swt-material-icons
Last synced: 25 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/greendelta/swt-material-icons
- Owner: GreenDelta
- License: apache-2.0
- Created: 2021-12-07T13:26:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-08T14:33:55.000Z (about 3 years ago)
- Last Synced: 2024-06-11T16:19:49.746Z (7 months ago)
- Language: Java
- Size: 506 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swt-material-icons
This package wraps the [Google material design icons](https://github.com/google/material-design-icons)
into a Java library so that these can be used in an [SWT](https://www.eclipse.org/swt/)
application. The icons are scaled down to 16x16 pixels as this size seems to
work best in an Eclipse RCP application.## Usage
An SWT image of an icon can be created via:
```java
var icon = MaterialIcons.LOCK.baseline();
var image = icon.image(display);
```Note that nothing is cached, and you need to dispose the image if it is not
needed anymore. The best way is to use the icons with a jface `ImageRegistry`.
Each icon has 4 variants (`baseline`, `outline`, `sharp`, `round`) and each
icon variant has a unique name:```java
MaterialIcons.LOCK.outline().name();
```You can also just use raw image data and apply a color on the icon:
```java
var icon = MaterialIcons.LAPTOP.outline();
var imageData = icon.data(new RGB(114, 252, 178));
```See also the [Example](./src/test/java/org/openlca/swt/material/icons/Example.java)
which produces a shell like this:![](./example_white.png)
or with dark background:
![](./example_dark.png)