Skip to content

Commit

Permalink
Add colorScheme Option
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Litzenburger committed Sep 18, 2021
1 parent b443246 commit 4b6ef23
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions MMM-RAIN-MAP.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![version](https://img.shields.io/github/package-json/v/jalibu/MMM-RAIN-MAP)](https://github.com/jalibu/MMM-RAIN-MAP/releases) [![Known Vulnerabilities](https://snyk.io/test/github/jalibu/MMM-RAIN-MAP/badge.svg?targetFile=package.json)](https://snyk.io/test/github/jalibu/MMM-RAIN-MAP?targetFile=package.json)

A Rain Radar Map based on the [Rainviewer API](https://www.rainviewer.com/) for the [MagicMirror²](https://magicmirror.builders/) platform.
Click here for the [Forum Thread](https://forum.magicmirror.builders/topic/12808/mmm-rain-map).
Click here for the [Forum Thread](https://forum.magicmirror.builders/topic/12808/mmm-rain-map).

Contribution welcome.

Expand Down Expand Up @@ -44,6 +44,7 @@ https://user-images.githubusercontent.com/25933231/130909536-e096d342-19d5-4139-
position: "top_left",
config: {
animationSpeedMs: 400,
colorScheme: 2,
colorizeTime: true,
defaultZoomLevel: 8,
displayTime: true,
Expand Down Expand Up @@ -80,6 +81,7 @@ https://user-images.githubusercontent.com/25933231/130909536-e096d342-19d5-4139-
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `animationSpeedMs` | Determines how fast the frames are played. <br><br>**Type:** `int` <br> **Default value:** `400` (time per frame in milliseconds) |
| `colorizeTime` | Set true, to colorize history and forecast timestamps. <br><br>**Type:** `boolean` <br> **Default value:** `true` |
| `colorScheme` | Set the color scheme for the rain layers. Click [here](https://www.rainviewer.com/api/color-schemes.html) to find your favorite scheme.<br><br>**Type:** `number` (0 - 8) <br> **Default value:** `2` (Universal Blue) |
| `defaultZoomLevel` | Fallback/default zoom value that is used if it is not explicitly set in a MapPostion. <br><br>**Type:** `int`<br>**Range:** `0 (whole world) - 20 (small building)`<br> **Default value:** `8` |
| `displayTime` | Set true, to display the time for each frame. <br><br>**Type:** `boolean` <br> **Default value:** `true` |
| `displayClockSymbol` | Set true, to display a clock symbol as time prefix. <br><br>**Type:** `boolean` <br> **Default value:** `true` |
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mmm-rain-map",
"version": "2.4.1",
"version": "2.5.0",
"description": "A Rain Radar Map based on the Rainviewer API for the MagicMirror² platform.",
"main": "MMM-RAIN-MAP.js",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Module.register<Config>('MMM-RAIN-MAP', {
defaults: {
animationSpeedMs: 400,
colorizeTime: true,
colorScheme: 2,
defaultZoomLevel: 8,
displayClockSymbol: true,
displayTime: true,
Expand Down Expand Up @@ -258,7 +259,7 @@ Module.register<Config>('MMM-RAIN-MAP', {
// Add new radar layers
for (const timeframe of self._runtimeData.timeframes) {
const radarLayer = new L.TileLayer(
'https://tilecache.rainviewer.com' + timeframe.path + '/256/{z}/{x}/{y}/2/1_1.png',
`https://tilecache.rainviewer.com${timeframe.path}/256/{z}/{x}/{y}/${this.config.colorScheme}/1_1.png`,
{
tileSize: 256,
opacity: 0.001,
Expand Down
1 change: 1 addition & 0 deletions src/types/Config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export type Config = {
animationSpeedMs: number
colorizeTime: boolean
colorScheme: number
defaultZoomLevel: number
displayClockSymbol: boolean
displayTime: boolean
Expand Down

0 comments on commit 4b6ef23

Please sign in to comment.