From 4569ed201b47c81ad9b0e6fc707de2217b660d44 Mon Sep 17 00:00:00 2001 From: MaBecker Date: Tue, 12 Nov 2019 17:42:18 +0100 Subject: [PATCH 1/2] new app "Show Color" --- apps.json | 12 ++++++++ apps/show-color-icon.js | 1 + apps/show-color.js | 60 ++++++++++++++++++++++++++++++++++++++++ apps/show-color.json | 5 ++++ apps/show-color.png | Bin 0 -> 237 bytes 5 files changed, 78 insertions(+) create mode 100644 apps/show-color-icon.js create mode 100644 apps/show-color.js create mode 100644 apps/show-color.json create mode 100755 apps/show-color.png diff --git a/apps.json b/apps.json index d0be75c34..3d818b124 100644 --- a/apps.json +++ b/apps.json @@ -384,5 +384,17 @@ {"name":"-jbells","url":"jbells.js"}, {"name":"*jbells","url":"jbells-icon.js","evaluate":true} ] + }, + { "id": "scolor", + "name": "Show Color", + "icon": "show-color.png", + "description": "Display all available Colors / Names", + "tags": "develop", + "type":"app", + "storage": [ + {"name":"+scolor","url":"show-color.json"}, + {"name":"-scolor","url":"show-color.js"}, + {"name":"*scolor","url":"show-color-icon.js","evaluate":true} + ] } ] diff --git a/apps/show-color-icon.js b/apps/show-color-icon.js new file mode 100644 index 000000000..d8b644f5a --- /dev/null +++ b/apps/show-color-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwxH+64A/AH4A/AH4AllYADqAADugAD4QAD5wADxgADnwADF/4v/F/4vMFQg0EFScyAAYv/F/4v/F5l0AAYqEGggqOlgADF/4v/F/4vMFQnOAAYqEGggqJmgADF/4v/F/4vMFRM+AAYqEGggqEnYADF/4v/F/4vMFR0sAAYqEGglrAAYv/F/4v/F5gqTnYADFQg0EF/4v/F/4vMAH4A/AH4A/AH4AIA")); diff --git a/apps/show-color.js b/apps/show-color.js new file mode 100644 index 000000000..9a28b26dc --- /dev/null +++ b/apps/show-color.js @@ -0,0 +1,60 @@ +/* jshint esversion: 6 */ +(function() { + + const colors = { + 0: { value: 0x0000, name: "Black" }, + 1: { value: 0x000F, name: "Navy" }, + 2: { value: 0x03E0, name: "DarkGreen" }, + 3: { value: 0x03EF, name: "DarkCyan" }, + 4: { value: 0x7800, name: "Maroon" }, + 5: { value: 0x780F, name: "Purple" }, + 6: { value: 0x7BE0, name: "Olive" }, + 7: { value: 0xC618, name: "LightGray" }, + 8: { value: 0x7BEF, name: "DarkGrey" }, + 9: { value: 0x001F, name: "Blue" }, + 10: { value: 0x07E0, name: "Green" }, + 11: { value: 0x07FF, name: "Cyan" }, + 12: { value: 0xF800, name: "Red" }, + 13: { value: 0xF81F, name: "Magenta" }, + 14: { value: 0xFFE0, name: "Yellow" }, + 15: { value: 0xFFFF, name: "White" }, + 16: { value: 0xFD20, name: "Orange" }, + 17: { value: 0xAFE5, name: "GreenYellow" }, + 18: { value: 0xF81F, name: "Pink" }, + }; + + const maxColors = 19; + var index = 0; + + function drawColor() { + + // draw filled rectangle + g.setColor(colors[index % maxColors].value); + g.fillRect(0, 24, g.getWidth(), g.getHeight()); + + // draw value name of color + g.setFontAlign(0, 0); + g.setColor(0xFFFF); + if (colors[index % maxColors].name == "White") + g.setColor(0); + g.setFont("6x8", 4); + g.drawString('0x' + colors[index % maxColors].value.toString(16), 120, 80); + g.setFont("6x8", 3); + g.drawString(colors[index % maxColors].name, 120, 160); + + // draw next button info + g.setFont("6x8", 2); + g.setFontAlign(0, 0, 3); + g.drawString("Next", 230, 60); + + // set watches for button 1 + index++; + setWatch(drawColor, BTN1, { repeate: true }); + + } + + g.clear(); + setWatch(drawColor, BTN1, { repeate: false }); + E.showMessage("Press BTN1\nto start"); + +})(); diff --git a/apps/show-color.json b/apps/show-color.json new file mode 100644 index 000000000..70d28e9d3 --- /dev/null +++ b/apps/show-color.json @@ -0,0 +1,5 @@ +{ + "name":"Show Color","type":"app", + "icon":"*scolor", + "src":"-scolor" +} diff --git a/apps/show-color.png b/apps/show-color.png new file mode 100755 index 0000000000000000000000000000000000000000..b8ac713e81c24f955a6f5f6f2ed6190e73ba49bf GIT binary patch literal 237 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDB3?!H8JlO)I)B}7%T)%wzA|<1vT3EUKLxIKi z6zkZN|Ie0cn&rQ*4KIHG-ErBsSoPSAcEROt+Z%ye8a-VcLo7}wOKfQf3@G^i&NlsA zNy(O_OC_ae@7Qr6u&Mfco}*)DU*DE3Dapy=;_9lZR$d<(WUgpvaFk7$G^wi6QdZSs z0iTeFNKlZLzCJJS(#0&%QBqeNyPBF7E(}~9b}_I?QieN#os-M!+#FALPO%J~23eEh iXD*J8yF7R-85rW4kG=Dbyp{!Y41=eupUXO@geCy|?p0y{ literal 0 HcmV?d00001 From 8b66eecd088f432289ee4fcdcc5cc9a4b6e953fe Mon Sep 17 00:00:00 2001 From: MaBecker Date: Tue, 12 Nov 2019 17:51:15 +0100 Subject: [PATCH 2/2] update tag --- apps.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 3d818b124..fe846bfba 100644 --- a/apps.json +++ b/apps.json @@ -388,8 +388,8 @@ { "id": "scolor", "name": "Show Color", "icon": "show-color.png", - "description": "Display all available Colors / Names", - "tags": "develop", + "description": "Display all available Colors and Names", + "tags": "tool", "type":"app", "storage": [ {"name":"+scolor","url":"show-color.json"},