Skip to content

Feature request: expose widgetRenderingMode to scripts (accented / Liquid Glass rendering) #16

Description

@AloneArcicBear

Feature request: expose widgetRenderingMode to scripts (accented / Liquid Glass rendering)

Problem

On macOS, when "Dim widgets on desktop" is set to Automatic (the default), ScriptWidget widgets become unreadable — they render as a solid white rectangle as soon as any app window is focused. This affects the bundled template scripts too, not just custom ones, so it doesn't look script-specific.

The cause seems to be Apple's accented rendering mode. Per Apple's docs ("Optimizing your widget for accented rendering mode and Liquid Glass"), in this mode the system:

  • tints primary and accented content white on iOS and macOS
  • tints opaque content with a single white color
  • removes the container background and replaces it with a glass/tint effect

Because a ScriptWidget script sets its background as a regular view attribute (e.g. <vstack background="#101014">) rather than through SwiftUI's containerBackground(for: .widget), the system treats that fill as opaque content and tints it white. The text is tinted white as well, so the result is white-on-white: a blank widget.

Current workaround

Setting "Dim widgets on desktop" to Never keeps widgets in full color and everything renders correctly. Omitting background from the root element also helps, but then there is no way to have a styled background in the normal full-color state.

Requested

Apple's recommended fix is for the widget to read the widgetRenderingMode environment value and adapt its layout per mode. That isn't reachable from JavaScript today. Two things would solve it:

  1. Expose the rendering mode to scripts, e.g. $getenv("widget-rendering-mode") returning fullColor / accented / vibrant, alongside the existing widget-size. Scripts could then drop custom backgrounds and colors when accented, exactly as Apple recommends.

  2. Apply the root element's background via containerBackground(for: .widget) instead of as a plain view modifier. The system would then remove it cleanly in accented mode rather than tinting it white — which would fix the blank-widget problem for existing scripts without any script changes.

(2) alone would fix the default case for everyone; (1) gives script authors real control.

Environment

  • macOS [version]
  • ScriptWidget [version] from the Mac App Store
  • Reproducible with the bundled templates and with custom scripts, medium and large sizes

References

Thanks for the app — the cross-platform JS/JSX approach is genuinely useful, and this is the one thing standing between it and a widget I can leave on the desktop all day.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions