mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2026-01-06 03:42:33 +01:00
Theme the toolbar and swing components
This commit is contained in:
@@ -29,6 +29,9 @@ dependencies {
|
||||
implementation("br.com.devsrsouza.compose.icons.jetbrains:font-awesome:0.2.0")
|
||||
implementation("com.github.Syer10:compose-router:45a8c4fe83")
|
||||
|
||||
// UI (Swing)
|
||||
implementation("com.github.weisj:darklaf-core:2.5.5")
|
||||
|
||||
// Threading
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3")
|
||||
|
||||
|
||||
@@ -17,12 +17,19 @@ import ca.gosyer.data.DataModule
|
||||
import ca.gosyer.data.server.ServerService
|
||||
import ca.gosyer.data.server.ServerService.ServerResult
|
||||
import ca.gosyer.data.ui.UiPreferences
|
||||
import ca.gosyer.data.ui.model.ThemeMode
|
||||
import ca.gosyer.data.ui.model.WindowSettings
|
||||
import ca.gosyer.ui.base.components.ErrorScreen
|
||||
import ca.gosyer.ui.base.components.LoadingScreen
|
||||
import ca.gosyer.ui.base.theme.AppTheme
|
||||
import ca.gosyer.util.system.getAsFlow
|
||||
import com.github.weisj.darklaf.LafManager
|
||||
import com.github.weisj.darklaf.theme.DarculaTheme
|
||||
import com.github.weisj.darklaf.theme.IntelliJTheme
|
||||
import com.github.zsoltk.compose.backpress.BackPressHandler
|
||||
import com.github.zsoltk.compose.backpress.LocalBackPressHandler
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import org.apache.logging.log4j.core.config.Configurator
|
||||
import toothpick.configuration.Configuration
|
||||
import toothpick.ktp.KTP
|
||||
@@ -56,6 +63,16 @@ fun main() {
|
||||
|
||||
val serverService = scope.getInstance<ServerService>()
|
||||
|
||||
scope.getInstance<UiPreferences>().themeMode()
|
||||
.getAsFlow {
|
||||
val theme = when (it) {
|
||||
ThemeMode.Light -> IntelliJTheme()
|
||||
ThemeMode.Dark -> DarculaTheme()
|
||||
}
|
||||
LafManager.install(theme)
|
||||
}
|
||||
.launchIn(GlobalScope)
|
||||
|
||||
val windowSettings = scope.getInstance<UiPreferences>().window()
|
||||
val (offset, size) = windowSettings.get().get()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user