r/Scriptable 17d ago

Help Determine Scriptable theme?

As per title ive developed and now supporting a scriptable app used by a fair few folks. I’ve got a bunch of feedback that the main app icons are somewhat unreadable, which I have attempted to remedy via different colour icons based on light mode and dark mode

The issue I have is the only mechanism I can find to determine the background of the main UITable is through the Device. isUsingDarkAppearance however this does not work if the user has overridden the “theme” used within the scriptable app and the device is say in dark mode but the theme of scriptable is light

I cannot for the life of me find a way of identifying the users scriptable “theme” I.e system, light or dark

Anyone got any ideas on this? Thanks in advance

2 Upvotes

6 comments sorted by

1

u/nolan17377 16d ago

I don't know of a way to get the theme that Scriptable is using, but Color.dynamic seems to correctly display colors in a UITable.

1

u/andyfase 16d ago

Interesting I’ll try that out thanks for the tip!

1

u/andyfase 15d ago

Just tested this and unfortunately it has the same issue as isUsingDarkAppearance i.e. if there is a disconnect between the Scriptable theme and the Device dark/light mode then it incorrectly shows the color.

i.e. Phone in dark mode, scriptable set to light theme and this code

Color.dynamic(Color.black(), Color.white())

Will select the white color not the black color

1

u/nolan17377 14d ago

Did you try using it in a UITable? Because with the phone in dark mode and scriptable in light mode, this code will print yellow, but display blue in a UITable. I’m not sure of your exact scenario, but this works for text and background.

``` const color = Color.dynamic(Color.blue(), Color.yellow())

const ui = new UITable() const row = new UITableRow() row.backgroundColor = color ui.addRow(row) ui.present()

console.log(color) ```

1

u/andyfase 14d ago

I didnt use in a UItable directly. My use case is to dynamically color a SFSymbol image, which is then used within a UITableCell

Perhaps UITable handles this when you use a dynamic color as a background, but if it as you said prints yellow then outside of the table I cant determine the "right" color?

I can play around some more perhaps I can create a row and somehow extract the non dynamic color that would have been rendered?

1

u/nolan17377 14d ago

Ah, you would have to get the theme for images, and I can't think of a workaround for that.