OXYGENHUB
# 1823bc12eda1 oxygenhub-android / app / src / test / java / io / oxygenhub / android / ui / ThemeTest.kt
1.2 KiB · last changed Panels you can see: the hub's palette by default, clear surface steps and a 1 dp edge on every panel (closes #24) 7 days ago source blame history raw
1
package io.oxygenhub.android.ui
2
3
import androidx.compose.material3.darkColorScheme
4
import androidx.compose.ui.graphics.Color
5
import androidx.compose.ui.graphics.luminance
6
import io.oxygenhub.android.ui.theme.lifted
7
import org.junit.Assert.assertTrue
8
import org.junit.Test
9
10
class ThemeTest {
11
    @Test
12
    fun wallpaperColoursInTheDarkLiftEachContainerAStepAboveTheLast() {
13
        // Android's dark tones a shade apart, as a near-black wallpaper gives them.
14
        val near = Color(0xFF121212)
15
        val s = lifted(
16
            darkColorScheme(
17
                background = Color(0xFF0F0F0F),
18
                onSurface = Color(0xFFE6E6E6),
19
                surfaceContainerLow = near,
20
                surfaceContainer = near,
21
                surfaceContainerHigh = near,
22
                surfaceContainerHighest = near,
23
            ),
24
        )
25
        val steps = listOf(s.background, s.surfaceContainerLow, s.surfaceContainer, s.surfaceContainerHigh, s.surfaceContainerHighest, s.outlineVariant)
26
            .map { it.luminance() }
27
        assertTrue("each above the last: $steps", steps.zipWithNext().all { (a, b) -> b > a })
28
        assertTrue("a panel's edge stands well off the background: $steps", steps.last() > steps.first() * 3)
29
    }
30
}