Skip to content

[Suggestion] Expose PlatformThemeDetector as a public API #63

@amir1376

Description

@amir1376

Hi @kdroidFilter Thank you for your great work!

It could be useful to expose PlatformThemeDetector so it can be used outside composable functions — for example, in StateFlows, ViewModels, or other non-UI logic.
Right now it seems limited to composable scope (internal objects), but having access to it globally would make platform theme detection much more flexible.

I mean something like this

expect class PlatformThemeDetector {
  // is it possible to retrieve theme Info from the OS? (instead of using `isDark=true` as fallback)
  fun isSupported(): Boolean

  // these are already implemented however they are not publicly available
  fun isDark(): Boolean
  fun registerListener(listener: Consumer<Boolean>)
  fun removeListener(listener: Consumer<Boolean>)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions