Force colour change?

I have a global that changes colour on day change.. at least it should but it won’t actually change colour until I open the widget config briefly.

I’m certainly no coder but I kind of understand why this happens but is there a way to force the change automatically?

My formula looks something like this:

$if(df(EEE)=mon,#111111*,*
df(EEE)=tue,#222222)$**

Grateful for any suggestions!

Hi @Williams ,

Try the following tips:

Weekday to Color

The formula used to change the color, based on the weekday short name:

$gv(tc(low,df(EEE)))$

I hope this would help.

:smiling_face::+1:

Did you set the KWGT app battery to “Unrestricted” in your phone settings?

Using df(EEE) = mon will break the widget if the system language changes. Use day numbers instead—df(e) outputs 1 for Monday, 2 for Tuesday, etc. It works globally on any language.

Your corrected formula should look like this:$if(df(e)=1, #FF111111, df(e)=2, #FF222222, #FF333333)$

@Baju_Santiko thank you I will try this! :folded_hands:t2:

@MaxP I have unrestricted setting on and everything else works and changes as it should (I have other stuff changing with days too). Thanks I hadn’t realised about the English day names! :man_facepalming:t2:

Ok, another problem I think I’m about to have :joy: that’s somewhat related to this..

I have created a font with “images” containing current weekday and if I use EEE to point to a specific image (letter) it won’t work unless english but if I use day number (e) there’s a problem when week is set to start on Sunday vs Monday right? I hope you understand how i mean..

0=Sat 1=Sun 2=Mon? This is driving me crazy the numbers corresponding to correct weekdays make no sense to me.

EDIT. I’m not sure but I think I got it now.. :man_shrugging:t2:

Here’s the setup I’m working on and you can see where I use weekdays to change color and “image”.

Hi @Williams ,

You can set your preferred First day of the week in the app settings.

I hope this would help.

:smiling_face::+1:

Thanks for the fast reply! :folded_hands:t2:

You can use $df(f) — ISO day of week (number, 1 = Monday).

@MaxP awesome thank you!

Sadly I still have the same problem, the color change wont happen at day change.. is it just for me this is not working? Id be grateful for suggestions. Edit. Would it help if I added something else to the formula, like oh I don’t know.. a new day + clock turns 00:00? I just want the color change to happen automatically without having to enter widget config.

$if(df(f)=1,#90D0F0,

df(f)=2,#90F090,

df(f)=3,#F0F090,

df(f)=4,#FFB060,

df(f)=5,#FF8080,

df(f)=6,#FFB0FF,

df(f)=7,#A080D0)$

Hi @Williams :

Here’s the steps you can follow to make the color of an element (I use text as the example) based on the weekday index.

STEP 1

Create 7 global variables (variable type: Color) for each weekday

Note

  • Using 7 global variables as the color for the element is recommended, it is easier for us to change each color anytime we like without having to manually edit the color codes in the formula

STEP 2

Create an element (I use Text element as the example)

Voila!

I hope this would help.

:smiling_face::+1:

@Baju_Santiko Thank you! :folded_hands:t2::star: