-
• #2
See the example at the bottom of the waveclk.
// Clear the screen once, at startup g.setTheme({bg:"#f0f",fg:"#fff",dark:true}).clear(); // draw immediately at first, queue update
-
• #3
I guess you refer to the line
g.setTheme({bg:"#f0f",fg:"#fff",dark:true}).clear();
This is actually an variant I tried before - and it is not working!
If background is globally set to green, f.e., it remains green even after that line!
In order to give you some steps to reproduce the problem (in the REPL):
Try
let customTheme = { fg:g.toColor(0,0,0), fg2:g.toColor(0,0,1), fgH:g.toColor(0,0,0), bg:g.toColor(0,1,0), bg2:g.toColor(0,1,0), bgH:g.toColor(1,1,0) }; let globalSettings = Object.assign( require('Storage').readJSON('setting.json', true) || {}, { theme:customTheme } ); require('Storage').writeJSON('setting.json', globalSettings);
first, then try
g.setTheme({ bg:'#000' }); g.clear(false);
(tested on a real device with firmware 2v11)
-
• #4
Try
g.setTheme({bg:"#f0f",fg:"#fff",dark:true}).clear(1);
? the1/true
parameter inclear
resets the current fg/bg color of Graphics to the theme colour.That seems to work great for me - if I run it at the same time as the clock and wait, the clock will redraw in that color.
-
• #5
Damn...
so my mistake was just to write
g.clear(false)
instead ofg.clear(true)
- good to know!Thank you very much!
Strange,
according to the docs, I should be able to define a (local) theme using
but that does not seem to be respected. Indeed, none of the alternatives I tried had any effect:
What am I doing wrong?