From f9d03d2d19753dce54eef19a4c8285c22da61e4a Mon Sep 17 00:00:00 2001 From: Kevin Kub Date: Sun, 18 Oct 2020 09:52:16 +0200 Subject: [PATCH] --- incidence.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/incidence.js b/incidence.js index afed1a2..fe0463c 100644 --- a/incidence.js +++ b/incidence.js @@ -8,21 +8,24 @@ Script.setWidget(widget) Script.complete() async function createWidget(items) { - Location.setAccuracyToKilometer() + Location.setAccuracyToThreeKilometers() const location = await Location.current() const data = await new Request(apiUrl(location)).loadJSON() const attr = data.features[0].attributes const incidence = attr.cases7_per_100k.toFixed(1) const cityName = attr.GEN - const gradient = new LinearGradient() - gradient.locations = [0, 1] - gradient.colors = [ - new Color("111111"), - new Color("222222") - ] const list = new ListWidget() - list.backgroundGradient = gradient - list.addText("🦠 Inzidenz") + if(Device.isUsingDarkAppearance()){ + const gradient = new LinearGradient() + gradient.locations = [0, 1] + gradient.colors = [ + new Color("111111"), + new Color("222222") + ] + list.backgroundGradient = gradient + } + const header = list.addText("🦠 Inzidenz".toUpperCase()) + header.font = Font.mediumSystemFont(13) list.addSpacer() const label = list.addText(incidence+"") label.font = Font.boldSystemFont(24)