Skip to content

fix: replace internal API with isSystemInDarkTheme() - #770

Open
ElviraMustafina wants to merge 3 commits into
masterfrom
LocalSystemTheme
Open

ElviraMustafina wants to merge 3 commits into
masterfrom
LocalSystemTheme

Conversation

@ElviraMustafina

Copy link
Copy Markdown
Collaborator

No description provided.


```kotlin
@OptIn(InternalComposeUiApi::class)
private val LocalIsDarkTheme = staticCompositionLocalOf<Boolean?> { null }

@MatkovIvan Ivan Matkov (MatkovIvan) Sep 7, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaring composition local is much easier

 val LocalIsDarkTheme = compositionLocalWithComputedDefaultOf { isSystemInDarkTheme() }

No expect/actual, no "object".

But the idea of this doc is to hack the system to override value that returned by isSystemInDarkTheme because libraries that user does not control use isSystemInDarkTheme directly

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the original version acceptable for now? I reverted the changes and will update the docs once a proper public API is available

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants