refactor: abstract colourScheme into common code
This commit is contained in:
parent
121b2bb555
commit
fa81dd8c0f
3 changed files with 34 additions and 35 deletions
|
|
@ -1,12 +1,27 @@
|
|||
package moe.lava.banksia.native
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.ColorScheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
@Composable
|
||||
expect fun BanksiaTheme(
|
||||
fun BanksiaTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
// Dynamic color is available on Android 12+
|
||||
dynamicColor: Boolean = true,
|
||||
content: @Composable () -> Unit
|
||||
)
|
||||
content: @Composable (() -> Unit)
|
||||
) {
|
||||
MaterialTheme(
|
||||
colorScheme = BanksiaTheme.colors(darkTheme, dynamicColor),
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
expect fun BanksiaTheme.colors(darkTheme: Boolean, dynamicColor: Boolean): ColorScheme
|
||||
|
||||
object BanksiaTheme {
|
||||
val colors: ColorScheme
|
||||
@Composable
|
||||
get() = colors(isSystemInDarkTheme(), true)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue