Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/barbwire-1/fitbit-color-themes

simple automated use of color themes in fitbit OS
https://github.com/barbwire-1/fitbit-color-themes

colorthemes fitbit settings

Last synced: 3 days ago
JSON representation

simple automated use of color themes in fitbit OS

Awesome Lists containing this project

README

        

# fitbit-color-themes 🎨
## Description:
This code automates the use of color-themes in `fitbit` apps.


You only need to define your themes and add a corresponding class to your elements, you want those colors be assigned to.
The last chosen theme gets saved and reused on reload of the app.
The first color of each theme gets written to your app's settings-page.


This repo is written in `ts` for `SDK 5.0.2`.

A `javascript` version will follow, or you might adjust the code by removing types.

---

## Installation:

- **app:**

Copy the folder `app/color_themes` into your app directory


app/index:

```javascript
import {initColorThemes} from "./color_themes/applyColors";
initColorThemes();
```
- **common:**

Copy the folder `common/color_themes` into your common directory.

- **companion:**

Integrate the code in `companion/index.ts` into your index file.

- **settings:**

Integrate the code from `settings/index.tsx` into your index file.


*(You can also download a template and start your project from there.)*

---
## Usage:
Define your array of color-themes in `common/color_themes/colorThemes.ts` like in the following example (no matter how many themes, or how many colors per theme):
```javascript
const themes :string[][] =
[
['tomato', 'blue', 'yellow'],
['sandybrown', 'white', 'grey'],
['gold', 'limegreen', '#000000'],
['aquamarine', 'turquoise', 'yellow'],
['deepskyblue', 'blue', 'red'],
['plum', 'magenta','white'],
];
```


To store/restore the last chosen color-theme, it gets written to a *.cbor file in

`common/color_themes/shared_preferences.js`
. Give this file a unique name.

*(I here took the UUID of my app + _fct.cbor.)*

```javascript
const FILE_NAME = "f100f76b-0a9e-488f-ba35-d1a8531a2d4b_fct.cbor";
```

The elements you want to be filled with a color of your themes need to be classed in `resources/index.view` like the following example:
```javascript





```



Now having x colors per theme, all fills get applied to the elements with

`class = "'color' + (0 to x-1)"`


The first color of each theme gets automatically implied in your app's setting-page - and done.

---


Please shout, if you have any issues or suggestions. And now...


Play it colorful! 🥳