diff --git a/apps.json b/apps.json index cc6cee99f..98c148603 100644 --- a/apps.json +++ b/apps.json @@ -396,5 +396,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 and Names", + "tags": "tool", + "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 000000000..b8ac713e8 Binary files /dev/null and b/apps/show-color.png differ