Skip to content

Commit 7ccba3b

Browse files
committed
各种样式优化
1 parent 665d5d5 commit 7ccba3b

File tree

9 files changed

+411
-238
lines changed

9 files changed

+411
-238
lines changed

composeApp/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repositories {
2222
kotlin {
2323
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
2424
wasmJs {
25-
moduleName = "composeApp"
25+
outputModuleName = "composeApp"
2626
useEsModules()
2727
browser {
2828
val projectDirPath = project.projectDir.path
@@ -46,6 +46,7 @@ kotlin {
4646
implementation(compose.foundation)
4747
implementation(compose.material3)
4848
implementation(compose.ui)
49+
implementation(compose.materialIconsExtended)
4950
// https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-images-resources.html
5051
implementation(compose.components.resources)
5152
implementation(compose.components.uiToolingPreview)
@@ -58,7 +59,7 @@ kotlin {
5859
// implementation(libs.androidx.lifecycle)
5960
implementation(libs.kotlinpoet)
6061
implementation(libs.kotlin.coroutine)
61-
val ktor = "3.0.0-beta-2"
62+
val ktor = "3.1.3"
6263
implementation("io.ktor:ktor-client-core:$ktor")
6364
implementation("io.ktor:ktor-client-content-negotiation:$ktor")
6465
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktor")

composeApp/src/wasmJsMain/kotlin/love/forte/simbot/codegen/App.kt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package love.forte.simbot.codegen
22

3+
import androidx.compose.foundation.isSystemInDarkTheme
34
import androidx.compose.material3.MaterialTheme
5+
import androidx.compose.material3.darkColorScheme
6+
import androidx.compose.material3.lightColorScheme
47
import androidx.compose.runtime.Composable
8+
import androidx.compose.ui.graphics.Color
59
import androidx.compose.ui.text.font.FontFamily
610
import love.forte.simbot.codegen.filesaver.saveAs
711
import love.forte.simbot.codegen.gen.GradleProjectViewModel
@@ -20,7 +24,47 @@ import simbot_codegen.composeapp.generated.resources.Res
2024
fun App() {
2125
val fm = FontFamily(Font(Res.font.LXGWNeoXiHeiScreen))
2226

27+
val darkTheme = isSystemInDarkTheme()
28+
29+
val colorScheme = if (darkTheme) {
30+
darkColorScheme(
31+
primary = Color(0xFF5B9EE1), // 柔和的蓝色
32+
secondary = Color(0xFF80CBBF), // 淡绿蓝色
33+
tertiary = Color(0xFFEFB196), // 淡橙色
34+
background = Color(0xFF1A1A1A), // 稍微柔和的黑色
35+
surface = Color(0xFF252525), // 柔和的暗色表面
36+
error = Color(0xFFE57373), // 淡红色错误提示
37+
onPrimary = Color(0xFFF5F5F5), // 主色上的文本
38+
onSecondary = Color(0xFF121212), // 次要色上的文本
39+
onTertiary = Color(0xFF121212), // 第三色上的文本
40+
onBackground = Color(0xFFE0E0E0), // 背景上的文本
41+
onSurface = Color(0xFFE0E0E0), // 表面上的文本
42+
surfaceVariant = Color(0xFF3A3A3A), // 表面变体
43+
primaryContainer = Color(0xFF2F4D6F), // 主色容器
44+
secondaryContainer = Color(0xFF396458) // 次要色容器
45+
)
46+
} else {
47+
lightColorScheme(
48+
primary = Color(0xFF3B7DD8), // 优雅的蓝色
49+
secondary = Color(0xFF4DB6A5), // 平衡的绿松石色
50+
tertiary = Color(0xFFEF9265), // 温和的橙色
51+
background = Color(0xFFF8F8F8), // 温和的白色背景
52+
surface = Color(0xFFFFFFFF), // 纯白色表面
53+
error = Color(0xFFD32F2F), // 标准错误色
54+
onPrimary = Color(0xFFFFFFFF), // 主色上的文本
55+
onSecondary = Color(0xFFFFFFFF), // 次要色上的文本
56+
onTertiary = Color(0xFFFFFFFF), // 第三色上的文本
57+
onBackground = Color(0xFF212121), // 背景上的文本
58+
onSurface = Color(0xFF212121), // 表面上的文本
59+
surfaceVariant = Color(0xFFE6E6E6), // 表面变体
60+
primaryContainer = Color(0xFFD4E3F8), // 主色容器
61+
secondaryContainer = Color(0xFFD4F0EB) // 次要色容器
62+
)
63+
}
64+
65+
2366
MaterialTheme(
67+
colorScheme = colorScheme,
2468
typography = MaterialTheme.typography.copy(
2569
displayLarge = MaterialTheme.typography.displayLarge.copy(fontFamily = fm),
2670
displayMedium = MaterialTheme.typography.displayMedium.copy(fontFamily = fm),

composeApp/src/wasmJsMain/kotlin/love/forte/simbot/codegen/gen/GradleProject.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class GradleProjectViewModel : ViewModel() {
4848
var gradleSettings by mutableStateOf(GradleSettings())
4949

5050
var simbotVersion: String? by mutableStateOf(null)
51-
var kotlinVersion: String by mutableStateOf("2.0.20") // TODO initial able?
51+
var kotlinVersion: String by mutableStateOf("2.1.20") // TODO initial able?
5252

5353
// TODO generate
5454
// var withSpring: Boolean by mutableStateOf(false)

0 commit comments

Comments
 (0)