Merge pull request #2049 from awkirk71/master

Matrix Clock: 24 Hour Format
master
Gordon Williams 2022-07-18 12:11:48 +01:00 committed by GitHub
commit afaa1c433b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 8 deletions

View File

@ -3,3 +3,4 @@
0.03: Keep the date from being overwritten, use correct colour from theme for clearing
0.04: Removed "wake LCD on face-up"-feature: A watch-face should not set things like "wake LCD on face-up".
0.05: Added support to other color themes (other then black)
0.06: Added support for 24 hour clock enabled from settings

View File

@ -5,10 +5,11 @@
## Settings
Please use the setting->App->Matrix Clock Menu to change the settings
| Setting | Description |
|-----------|--------------------------------------------------------------------------------------------------------------------|
| Color | by default set to **'theme'** to follow the theme colors. Selector also offers a selection of other colour schemes |
| Intensity | Changes the number of matrix streams that are falling |
| Setting | Description |
|-------------|--------------------------------------------------------------------------------------------------------------------|
| Color | By default set to **'theme'** to follow the theme colors. Selector also offers a selection of other colour schemes |
| Time Format | Choose between 12 hour and 24 hour time format |
| Intensity | Changes the number of matrix streams that are falling |
## Colour Themes

View File

@ -10,9 +10,16 @@
const Locale = require('locale');
const PREFERENCE_FILE = "matrixclock.settings.json";
const settings = Object.assign({color: "theme", intensity: 'light'},
const settings = Object.assign({color: "theme", time_format: '12 hour', intensity: 'light'},
require('Storage').readJSON(PREFERENCE_FILE, true) || {});
var format_time;
if(settings.time_format == '24 hour'){
format_time = (t) => format_time_24_hour(t);
} else {
format_time = (t) => format_time_12_hour(t);
}
const colors = {
'gray' :[0.5,0.5,0.5],
'green': [0,1.0,0],
@ -247,8 +254,14 @@ function format_date(now){
return Locale.dow(now,1) + " " + format00(now.getDate());
}
function format_time_24_hour(now){
var time = new Date(now.getTime());
var hours = time.getHours() ;
function format_time(now){
return format00(hours) + ":" + format00(time.getMinutes());
}
function format_time_12_hour(now){
var time = new Date(now.getTime());
var hours = time.getHours() % 12;
if(hours < 1){

View File

@ -1,6 +1,6 @@
(function(back) {
const PREFERENCE_FILE = "matrixclock.settings.json";
var settings = Object.assign({color : "theme", intensity: "light"},
var settings = Object.assign({color : "theme", time_format: '12 hour', intensity: "light"},
require('Storage').readJSON(PREFERENCE_FILE, true) || {});
console.log("loaded:" + JSON.stringify(settings));
@ -44,6 +44,7 @@
'white on red',
'white on blue'
]),
"Time Format": stringInSettings("time_format", ['12 hour','24 hour']),
"Intensity": stringInSettings("intensity", ['light',
'medium',
'high'])

View File

@ -1,7 +1,7 @@
{
"id": "matrixclock",
"name": "Matrix Clock",
"version": "0.05",
"version": "0.06",
"description": "inspired by The Matrix, a clock of the same style",
"icon": "matrixclock.png",
"screenshots": [{"url":"matrix_green_on_black.jpg"}],