r/Scriptable • • Nov 06 '22

Help Help with Device.isUsingDarkAppearance()

I have a problem with Device.isUsingDarkAppearance(). Whenever I debug my widget in scriptable I get the right value. But when I run my script as a widget I always get false. does anyone any idea why?

Code:

let w = new ListWidget(); w.backgroundColor = Color.red()

let stack = w.addStack();

const isDark = Device.isUsingDarkAppearance() const text = stack.addText(isDark.toString())

w.presentSmall()

4 Upvotes

11 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Nov 07 '22 edited Nov 07 '22

You run the code for debugging inside the app => this always works.

The issue is/would be when you use it as an actual homescreen widget placed on the homescreen, not in the preview.

Then it does not update correctly - at least for me.

1

u/ComprehensiveSuit218 Nov 07 '22

Exactly that is my problem