Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions application/composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ kotlin {
implementation(libs.room.runtime)

implementation(libs.compose.navigation)
implementation(libs.platformtools.darkmodedetector)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.ApplicationScope
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.WindowPlacement
import androidx.compose.ui.window.WindowPosition
import androidx.compose.ui.window.application
import androidx.compose.ui.window.rememberWindowState
import androidx.compose.ui.window.*
import io.github.kdroidfilter.platformtools.darkmodedetector.isSystemInDarkMode
import io.github.kdroidfilter.platformtools.darkmodedetector.windows.setWindowsAdaptiveTitleBar
import io.writeopia.common.utils.keyboard.KeyboardCommands
import io.writeopia.common.utils.keyboard.isMultiSelectionTrigger
import io.writeopia.common.utils.ui.GlobalToastBox
Expand Down Expand Up @@ -167,7 +164,6 @@ private fun ApplicationScope.App(onCloseRequest: () -> Unit = ::exitApplication)
windowState.placement = WindowPlacement.Floating
}
}

Window(
onCloseRequest = onCloseRequest,
title = "",
Expand All @@ -177,6 +173,12 @@ private fun ApplicationScope.App(onCloseRequest: () -> Unit = ::exitApplication)
},
icon = CommonImages.logo()
) {
// Synchronize the topbar on Windows OS with the System Theme
window.setWindowsAdaptiveTitleBar(
dark = isSystemInDarkMode()
// TODO Syncrhonize with the selected Theme by the user
)

Box(Modifier.fillMaxSize()) {
LaunchedEffect(window.rootPane) {
with(window.rootPane) {
Expand Down
1 change: 1 addition & 0 deletions application/core/theme/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ kotlin {

implementation(compose.material3)
implementation(libs.lifecycle.viewmodel.compose)
implementation(libs.platformtools.darkmodedetector)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.writeopia.model

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import io.github.kdroidfilter.platformtools.darkmodedetector.isSystemInDarkMode

enum class ColorThemeOption(val theme: String) {
LIGHT("light"),
Expand All @@ -20,6 +20,6 @@ fun ColorThemeOption?.isDarkTheme(): Boolean =
when (this) {
ColorThemeOption.LIGHT -> false
ColorThemeOption.DARK -> true
ColorThemeOption.SYSTEM -> isSystemInDarkTheme()
else -> isSystemInDarkTheme()
ColorThemeOption.SYSTEM -> isSystemInDarkMode()
else -> isSystemInDarkMode()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.writeopia.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
Expand All @@ -9,6 +8,7 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import io.github.kdroidfilter.platformtools.darkmodedetector.isSystemInDarkMode

private val DarkColorPalette = darkColorScheme(
primary = LIGHT_PURPLE,
Expand Down Expand Up @@ -71,7 +71,7 @@ val LocalWriteopiaColors = staticCompositionLocalOf {

@Composable
fun WrieopiaTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
darkTheme: Boolean = isSystemInDarkMode(),
content: @Composable () -> Unit
) {
val globalBackground = if (darkTheme) Color(0xFF252525) else Color(0xFFF8F0F9)
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ktor = "3.0.3"
ktlint = "12.1.2"
ktx = "1.15.0"
material = "1.12.0"
platformtools = "0.2.9"
postgresSocketFactory = "1.15.1"
r2dbcDriver = "2.0.2"
room = "2.7.0-rc03"
Expand Down Expand Up @@ -78,6 +79,8 @@ ktor-server-core = { module = "io.ktor:ktor-server-core-jvm" }
ktor-server-websocket = { module = "io.ktor:ktor-server-websockets-jvm" }
ktor-server-netty = { module = "io.ktor:ktor-server-netty-jvm" }
ktor-server-tests = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
#material3-desktop = { module = "org.jetbrains.compose.material3:material3-desktop", version.ref = "material3" }
platformtools-darkmodedetector = { module = "io.github.kdroidfilter:platformtools.darkmodedetector", version.ref = "platformtools" }
r2dbc-driver = { module = "app.cash.sqldelight:r2dbc-driver", version.ref = "r2dbcDriver" }
sql-postgres-socket-factory = { module = "com.google.cloud.sql:postgres-socket-factory", version.ref = "postgresSocketFactory" }
room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" }
Expand Down