Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.
This repository was archived by the owner on Aug 17, 2025. It is now read-only.

Support the changing of theme dynamically #34

@garrettmurray

Description

@garrettmurray

Is your feature request related to a problem? Please describe.
Currently, SwiftDownEditor stores the theme internally, and therefore the theme is not able to be changed from the outside. For modern apps which support light and dark mode, this means any SwiftDownEditors in use will always be stuck with the theme they were created with, which leads to a poor user experience.

Describe the solution you'd like
Ideally, setting the theme would redraw the SwiftDownEditor, such that you could base the current theme on the environment's color scheme to automatically support light/dark modes. This would also allow for a user to change themes while utilizing the editor, with, say, a drop-down of available themes.

Describe alternatives you've considered
Without this, the SwiftDownEditor would need to effectively be removed from the hierarchy, and recreated, which doesn't feel very SwiftUI-like.

Additional context
A quick example of what I expected to do for supporting system-wide dark/light mode:

@Environment(\.colorScheme) var colorScheme

SwiftDownEditor(text: $itemText)
  .insetsSize(20)
  .theme(colorScheme == .dark ? Theme.BuiltIn.defaultDark.theme() : Theme.BuiltIn.defaultLight.theme())
  .debounceTime(0.5)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions