* Fork the https://github.com/espruino/BangleApps git repository
* Add your files
* Go to GitHub Settings and activate GitHub Pages
* Run your personal `Bangle App Loader` at https://\<your-github-username\>.github.io/BangleApps/index.html to load apps onto your device
* Your apps should be inside it - if there are problems, check your web browser's 'developer console' for errors
Be aware of the delay between commits and updates on github.io - it can take a few minutes (and a 'hard refresh' of your browser) for changes to take effect.
### Offline
You can add the following to the Espruino Web IDE:
```
// replace with your 7chname app name
var appname = "mygreat";
require("Storage").write('*'+appname,
// place app-icon.js contents here
);
//
require("Storage").write("+"+appname,{
"name":"My Great App","type":"",
"icon":"*"+appname,
"src":"-"+appname,
});
require("Storage").write("-"+appname,`
// place contents of app.js here
// be aware of double-quoting templated strings
`
```
When you upload code this way, your app will be uploaded to Bangle.js's menu
without you having to use the `Bangle App Loader`
## Example Applications
To make the process easier we've come up with some example applications that you can use as a base
when creating your own. Just come up with a unique 7 character name, copy `apps/_example_app`
or `apps/_example_widget` to `apps/7chname`, and add `apps/_example_X/add_to_apps.json` to
`apps.json`.
### App Example
The app example is available in [`apps/_example_app`](apps/_example_app)
Apps are listed in the Bangle.js menu, accessible from a clock app via the middle button.
*`add_to_apps.json` - insert into `apps.json`, describes the widget to bootloader and loader
*`app.png` - app icon - 48x48px
*`app-icon.js` - JS version of the icon (made with http://www.espruino.com/Image+Converter) for use in Bangle.js's menu
*`app.json` - short app name for Bangle.js menu and storage filenames
*`app.js` - app code
#### `app-icon.js`
The icon image and short description is used in the menu entry as selection posibility.
Use the Espruino [image converter](https://www.espruino.com/Image+Converter) and upload your `app.png` file.
Follow this steps to create a readable icon as image string.
1. upload a png file
2. set _X_ Use Compression
3. set _X_ Transparency (optional)
4. set Diffusion: _flat_
5. set Colours: _1 bit_, _4 bit_ or _8 bit Web Palette_
6. set Output as: _Image String_
Replace this line with the image converter output:
* name, icon and description present the app in the app loader.
* tags is used for grouping apps in the library, separate multiple entries by comma. Known tags are `tool`, `system`, `clock`, `game`, `sound`, `gps`, `widget` or empty.
* storage is used to identify the app files and how to handle them
## Coding hints
- use `g.setFont(.., size)` to multiply the font size, eg ("6x8",3) : "18x24"
- use `g.drawString(text,x,y,true)` to draw with background color to overwrite existing text
- use `g.clearRect()` to clear parts of the screen, instead of using `g.clear()`
- use `g.fillPoly()` or `g.drawImage()` for complex graphic elements
- using `g.clear()` can cause screen flicker
- using `g.setLCDBrightness()` can save you power during long periods with lcd on
The majority of icons used for these apps are from [Icons8](https://icons8.com/) - we have a commercial license but icons are also free for Open Source projects.