|
27 | 27 |
|
28 | 28 | #include "Settings.h" |
29 | 29 |
|
30 | | -#define VERSION "3.01" |
| 30 | +#define VERSION "3.02" |
31 | 31 |
|
32 | 32 | #define HOSTNAME "CLOCK-" |
33 | 33 | #define CONFIG "/conf.txt" |
@@ -132,7 +132,8 @@ static const char CHANGE_FORM2[] PROGMEM = "<p><input name='isPM' class='w3-chec |
132 | 132 | "<p>Display Brightness <input class='w3-border w3-margin-bottom' name='ledintensity' type='number' min='0' max='15' value='%INTENSITYOPTIONS%'></p>" |
133 | 133 | "<p>Display Scroll Speed <select class='w3-option w3-padding' name='scrollspeed'>%SCROLLOPTIONS%</select></p>" |
134 | 134 | "<p>Minutes Between Refresh Data <select class='w3-option w3-padding' name='refresh'>%OPTIONS%</select></p>" |
135 | | - "<p>Minutes Between Scrolling Data <input class='w3-border w3-margin-bottom' name='refreshDisplay' type='number' min='1' max='10' value='%REFRESH_DISPLAY%'></p>"; |
| 135 | + "<p>Minutes Between Scrolling Data <input class='w3-border w3-margin-bottom' name='refreshDisplay' type='number' min='1' max='10' value='%REFRESH_DISPLAY%'></p>" |
| 136 | + "<p>Theme Color <select class='w3-option w3-padding' name='theme'>%THEME_OPTIONS%</select></p>"; |
136 | 137 |
|
137 | 138 | static const char CHANGE_FORM3[] PROGMEM = "<hr><p><input name='isBasicAuth' class='w3-check w3-margin-top' type='checkbox' %IS_BASICAUTH_CHECKED%> Use Security Credentials for Configuration Changes</p>" |
138 | 139 | "<p><label>Marquee User ID (for this web interface)</label><input class='w3-input w3-border w3-margin-bottom' type='text' name='userid' value='%USERID%' maxlength='20'></p>" |
@@ -179,6 +180,29 @@ static const char OCTO_FORM[] PROGMEM = "<form class='w3-container' action='/sav |
179 | 180 | "<button class='w3-button w3-block w3-green w3-section w3-padding' type='submit'>Save</button></form>" |
180 | 181 | "<script>function isNumberKey(e){var h=e.which?e.which:event.keyCode;return!(h>31&&(h<48||h>57))}</script>"; |
181 | 182 |
|
| 183 | +static const char COLOR_THEMES[] PROGMEM = "<option>red</option>" |
| 184 | + "<option>pink</option>" |
| 185 | + "<option>purple</option>" |
| 186 | + "<option>deep-purple</option>" |
| 187 | + "<option>indigo</option>" |
| 188 | + "<option>blue</option>" |
| 189 | + "<option>light-blue</option>" |
| 190 | + "<option>cyan</option>" |
| 191 | + "<option>teal</option>" |
| 192 | + "<option>green</option>" |
| 193 | + "<option>light-green</option>" |
| 194 | + "<option>lime</option>" |
| 195 | + "<option>khaki</option>" |
| 196 | + "<option>yellow</option>" |
| 197 | + "<option>amber</option>" |
| 198 | + "<option>orange</option>" |
| 199 | + "<option>deep-orange</option>" |
| 200 | + "<option>blue-grey</option>" |
| 201 | + "<option>brown</option>" |
| 202 | + "<option>grey</option>" |
| 203 | + "<option>dark-grey</option>" |
| 204 | + "<option>black</option>" |
| 205 | + "<option>w3schools</option>"; |
182 | 206 |
|
183 | 207 |
|
184 | 208 | const int TIMEOUT = 500; // 500 = 1/2 second |
@@ -560,6 +584,7 @@ void handleLocations() { |
560 | 584 | timeDisplayTurnsOff = decodeHtmlString(server.arg("endTime")); |
561 | 585 | displayIntensity = server.arg("ledintensity").toInt(); |
562 | 586 | minutesBetweenDataRefresh = server.arg("refresh").toInt(); |
| 587 | + themeColor = server.arg("theme"); |
563 | 588 | minutesBetweenScrolling = server.arg("refreshDisplay").toInt(); |
564 | 589 | displayScrollSpeed = server.arg("scrollspeed").toInt(); |
565 | 590 | IS_BASIC_AUTH = server.hasArg("isBasicAuth"); |
@@ -832,6 +857,9 @@ void handleConfigure() { |
832 | 857 | options.replace(">" + minutes + "<", " selected>" + minutes + "<"); |
833 | 858 | form.replace("%OPTIONS%", options); |
834 | 859 | form.replace("%REFRESH_DISPLAY%", String(minutesBetweenScrolling)); |
| 860 | + String themeOptions = FPSTR(COLOR_THEMES); |
| 861 | + themeOptions.replace(">" + String(themeColor) + "<", " selected>" + String(themeColor) + "<"); |
| 862 | + form.replace("%THEME_OPTIONS%", themeOptions); |
835 | 863 |
|
836 | 864 | server.sendContent(form); //Send another chunk of the form |
837 | 865 |
|
@@ -958,7 +986,7 @@ void sendHeader() { |
958 | 986 | html += "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />"; |
959 | 987 | html += "<meta name='viewport' content='width=device-width, initial-scale=1'>"; |
960 | 988 | html += "<link rel='stylesheet' href='https://www.w3schools.com/w3css/4/w3.css'>"; |
961 | | - html += "<link rel='stylesheet' href='https://www.w3schools.com/lib/w3-theme-blue-grey.css'>"; |
| 989 | + html += "<link rel='stylesheet' href='https://www.w3schools.com/lib/w3-theme-" + themeColor + ".css'>"; |
962 | 990 | html += "<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.1/css/all.min.css'>"; |
963 | 991 | html += "</head><body>"; |
964 | 992 | server.sendContent(html); |
@@ -1320,6 +1348,7 @@ String writeCityIds() { |
1320 | 1348 | f.println("USE_PIHOLE=" + String(USE_PIHOLE)); |
1321 | 1349 | f.println("PiHoleServer=" + PiHoleServer); |
1322 | 1350 | f.println("PiHolePort=" + String(PiHolePort)); |
| 1351 | + f.println("themeColor=" + themeColor); |
1323 | 1352 | } |
1324 | 1353 | f.close(); |
1325 | 1354 | readCityIds(); |
@@ -1511,6 +1540,11 @@ void readCityIds() { |
1511 | 1540 | PiHolePort = line.substring(line.lastIndexOf("PiHolePort=") + 11).toInt(); |
1512 | 1541 | Serial.println("PiHolePort=" + String(PiHolePort)); |
1513 | 1542 | } |
| 1543 | + if (line.indexOf("themeColor=") >= 0) { |
| 1544 | + themeColor = line.substring(line.lastIndexOf("themeColor=") + 11); |
| 1545 | + themeColor.trim(); |
| 1546 | + Serial.println("themeColor=" + themeColor); |
| 1547 | + } |
1514 | 1548 | } |
1515 | 1549 | fr.close(); |
1516 | 1550 | matrix.setIntensity(displayIntensity); |
|
0 commit comments