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
38 changes: 22 additions & 16 deletions app/desktop/src/main/kotlin/io/github/cubsync/desktop/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,25 @@ data class CubColors(

internal val DarkCubColors = CubColors(
isDark = true,
// The phone's dark palette, value for value. The desktop had its own near-black set
// (#0F1116 against #141318), so the two ends looked like two products side by side —
// and the phone's is the one the design tokens name.
background = Color(0xFF141318),
surface = Color(0xFF141318),
surfaceRaised = Color(0xFF1F1F26),
surfaceSunken = Color(0xFF26252C),
// `html[data-theme="dark"]`, value for value — the desktop's own dark set, not the
// phone's. Taking the phone's (#141318 for both the canvas and the panels) put every
// card on the colour it was meant to stand on, and a window of one flat black field
// is what "深色模式看不清" looks like: nothing separates, so nothing reads.
background = Color(0xFF0F1116),
surface = Color(0xFF181B21),
surfaceRaised = Color(0xFF1E222A),
surfaceSunken = Color(0xFF242932),
outline = Color(0xFF2A2F39),
outlineFaint = Color(0xFF232229),
outlineStrong = Color(0xFF3A3942),
text = Color(0xFFE6E1E9),
textDim = Color(0xFFC9C5D0),
textFaint = Color(0xFF8E8A97),
outlineFaint = Color(0xFF22262E),
outlineStrong = Color(0xFF343A46),
text = Color(0xFFE8EBF1),
// `--dim` is #98A1B0 and `--dim-2` is #6D7686 in the prototype. Both were raised for
// the dark window: at 11–12sp these two carry every explanatory line, and on a panel
// the prototype's own values read as grey-on-grey — the complaint that started this.
// The structure (canvas, panel, raised, sunken) is still the prototype's, value for
// value; only the two text weights moved, and `决策记录` says why.
textDim = Color(0xFFC2CAD8),
textFaint = Color(0xFF97A0AE),
accent = Color(0xFF1E88E5),
// `color-mix(in srgb, var(--win-accent) 14%, transparent)` — translucent on purpose,
// so it composites over whatever it is put on exactly as the prototype's does.
Expand All @@ -81,10 +87,10 @@ internal val DarkCubColors = CubColors(
success = Color(0xFF2E9E5B),
conflict = Color(0xFFF0731F),
info = Color(0xFF3B82F6),
rail = Color(0xFF1F1F26),
hover = Color(0xFF26252C),
selected = Color(0x2E4C6EF5),
selectedLine = Color(0xFF4C6EF5),
rail = Color(0xFF181B21),
hover = Color(0xFF232833),
selected = Color(0xFF1D2C3E),
selectedLine = Color(0xFF2B5F8F),
)

internal val LightCubColors = CubColors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ fun SettingRow(
) {
Column(Modifier.weight(1f)) {
Text(label, style = CubType.label, color = colors.text)
if (hint.isNotEmpty()) Text(hint, style = CubType.meta, color = colors.textFaint)
if (hint.isNotEmpty()) Text(hint, style = CubType.meta, color = colors.textDim)
}
control()
}
Expand Down Expand Up @@ -312,7 +312,7 @@ fun Toggle(checked: Boolean, enabled: Boolean = true, onChange: (Boolean) -> Uni
fun KeyValueRow(key: String, value: String, dim: Boolean = false) {
val colors = CubTheme.colors
Row(Modifier.fillMaxWidth().padding(vertical = 2.dp), verticalAlignment = Alignment.Top) {
Text(key, style = CubType.meta, color = colors.textFaint, modifier = Modifier.width(96.dp))
Text(key, style = CubType.meta, color = colors.textDim, modifier = Modifier.width(96.dp))
Text(
value.ifEmpty { "—" },
style = CubType.body,
Expand Down Expand Up @@ -459,7 +459,7 @@ fun EmptyState(text: String, detail: String = "", action: (@Composable () -> Uni
Text(text, style = CubType.body, color = colors.textDim)
if (detail.isNotEmpty()) {
Spacer(Modifier.height(4.dp))
Text(detail, style = CubType.meta, color = colors.textFaint)
Text(detail, style = CubType.meta, color = colors.textDim)
}
if (action != null) {
Spacer(Modifier.height(10.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ private fun NegotiationCard(state: AppState, modifier: Modifier) {

Spacer(Modifier.height(14.dp))
Kv("本机版本 / 远端版本") {
"${BuildInfo.PROTOCOL_VERSION * 100} / ${(peer?.protocolVersion ?: 0) * 100}"
// No peer is not version zero: an em dash says "nothing to compare with",
// where 0 read as a build from before the protocol existed.
val remote = peer?.protocolVersion?.let { "${it * 100}" } ?: DASH
"${BuildInfo.PROTOCOL_VERSION * 100} / $remote"
}
Kv("比对到的能力位") { "$agreed / $total" }
Kv("v3 老版本远端") { "仅退出双向模式(清晰提示,不错位)" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ object Preview {
view: DisplayMode? = null,
displayMenu: Boolean = false,
): AppState {
// Each state starts from the same tree: the scratch area is emptied here rather
// than once per JVM, so a screen cannot be photographed with whatever the test
// before it happened to leave behind.
runCatching { scratch.toFile().deleteRecursively() }
Files.createDirectories(scratch)

val directory = Files.createTempDirectory("cubsync-preview-")
val log = AppLog(now = { NOW })
val desktop = DesktopSettings.inStateDirectory(directory)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/desktop/src/test/resources/screenshots/windows/01-connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/desktop/src/test/resources/screenshots/windows/02-sync.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/desktop/src/test/resources/screenshots/windows/03-jobs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/desktop/src/test/resources/screenshots/windows/05-logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading