diff --git a/apps/smclock/ChangeLog b/apps/smclock/ChangeLog index 0300d5ceb..f0b5c5bde 100644 --- a/apps/smclock/ChangeLog +++ b/apps/smclock/ChangeLog @@ -2,3 +2,4 @@ 0.02: Add battery level 0.03: Fix battery display when full 0.04: Add support for settings +0.05: Add ability to change background (3bit or 4bit) diff --git a/apps/smclock/README.md b/apps/smclock/README.md index 635292d0c..7a099f268 100644 --- a/apps/smclock/README.md +++ b/apps/smclock/README.md @@ -10,7 +10,9 @@ It shows battery level in the upper left corner, date information in the upper r **Analog Clock:** -**Human Readable Date:** When the setting is on, the date is shown in a more human-friendly format (e.g. "Oct 2"), otherwise the date is shown in a standard format (e.g. "02/10"). Default is off. +**Background:** When the setting is set as "3bit", a background with more accurate colors is chosen for the watchface. Otherwise, it uses a background following the 16-bit Mac Color Palette. + +**Date Format:** When the setting is set as "Long", the date is shown in a more human-friendly format (e.g. "Oct 2"), otherwise the date is shown in a standard format (e.g. "02/10"). Default is off. **Show Week Info:** When the setting is on, the weekday and week number are shown in the upper right box. When the setting is off, the full year is shown instead. Default is off. diff --git a/apps/smclock/app.js b/apps/smclock/app.js index 0ef886b04..297ddb894 100644 --- a/apps/smclock/app.js +++ b/apps/smclock/app.js @@ -1,5 +1,10 @@ const SETTINGSFILE = "smclock.json"; -const background = { +const image3bit = { + width : 176, height : 176, bpp : 3, + transparent : 1, + buffer : require("heatshrink").decompress(atob("/4A/AH4AC23btoCct/pkmSpICcIP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5Bp/4A/AH4AC/kAAH0/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5B/IP5BpA=")) +}; +const image4bit = { width : 176, height : 176, bpp : 4, transparent : 1, buffer : require("heatshrink").decompress(atob("/4A/AH4Au1QAp1/2swApK/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K/5X/K+//AH4A/AF8AAH4AUK/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/4A/K/5X/AH5X/K/5X/AH5X/K/5X/AH5X/K/4A/K/5X/K/4A/K/5X/K/AA==")) @@ -12,6 +17,7 @@ var batLevel = -1; var batColor = [0, 0, 0]; // settings variables +var backgroundImage; var dateFormat; var drawInterval; var pollInterval; @@ -25,6 +31,7 @@ function loadSettings() { function def(value, def) {return value !== undefined ? value : def;} var settings = require("Storage").readJSON(SETTINGSFILE, true) || {}; + backgroundImage = def(settings.backgroundImage, "3bit"); dateFormat = def(settings.dateFormat, "Short"); drawInterval = def(settings.drawInterval, 10); pollInterval = def(settings.pollInterval, 60); @@ -75,6 +82,12 @@ function getBatteryColor(level) { } function draw() { + var background; + if (backgroundImage == "3bit") { + background = image3bit; + } else { + background = image4bit; + } g.drawImage(background); const color = getBatteryColor(batLevel); diff --git a/apps/smclock/screenshot1.png b/apps/smclock/screenshot1.png index 70e28bac9..1a020c9ca 100644 Binary files a/apps/smclock/screenshot1.png and b/apps/smclock/screenshot1.png differ diff --git a/apps/smclock/settings.js b/apps/smclock/settings.js index a6c7d1b98..ee4a35a26 100644 --- a/apps/smclock/settings.js +++ b/apps/smclock/settings.js @@ -52,6 +52,7 @@ writeSettings(); }, }, + "Background": stringInSettings("backgroundImage", ["3bit", "4bit"]), Date: stringInSettings("dateFormat", ["Long", "Short"]), "Draw Interval": { value: settings.drawInterval,