diff --git a/CHANGELOG.md b/CHANGELOG.md index fa59ef4..a71f9f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,16 @@ # Changelog +# v0.0.7: + +- import Semantics color from compound token, and new color: `iconAccentPrimary`, and make them public so that they can be copied to override colors. +- New icons: `ExtensionsSolid`, `MarkAsRead`, `MarkAsUnread`, `Minus` + # v0.0.6: - Remove Accompanist SystemUiController library. - Bump dependencies: Kotlin `1.9.23`, Compose BOM `2024.04.00`, Material3 `1.3.1`, AGP `8.3.1`, Robolectric `4.12.1`. - Update Compound tokens (new decorative colors, photo solid icon). +- Add more screenshot tests. # v0.0.5: diff --git a/compound/build.gradle.kts b/compound/build.gradle.kts index e50728a..1359b73 100644 --- a/compound/build.gradle.kts +++ b/compound/build.gradle.kts @@ -99,7 +99,7 @@ mavenPublishing { publishToMavenCentral(SonatypeHost.S01) signAllPublications() - coordinates("io.element.android", "compound-android", "0.0.6") + coordinates("io.element.android", "compound-android", "0.0.7") if (!providers.gradleProperty("mavenCentralUsername").isPresent) { println("No maven central provider") } diff --git a/compound/screenshots/Compound Semantic Colors - Dark HC.png b/compound/screenshots/Compound Semantic Colors - Dark HC.png new file mode 100644 index 0000000..127e4fe --- /dev/null +++ b/compound/screenshots/Compound Semantic Colors - Dark HC.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ebab4344dba788b195d19615ba14d695774948d6ee9cde9f3c639c37599c3aca +size 407514 diff --git a/compound/screenshots/Compound Semantic Colors - Dark.png b/compound/screenshots/Compound Semantic Colors - Dark.png index 71d4719..d037ff4 100644 --- a/compound/screenshots/Compound Semantic Colors - Dark.png +++ b/compound/screenshots/Compound Semantic Colors - Dark.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b0f2e4be4f9ecaaad5d5d06a6cf865c4cc92be1e6ae0f5c923b0f19db4326e04 -size 309546 +oid sha256:4e75bb84d5194481b1c196fbaaa367e63eafc3fb3c447dfa61e6bb90b0e64a88 +size 405704 diff --git a/compound/screenshots/Compound Semantic Colors - Light HC.png b/compound/screenshots/Compound Semantic Colors - Light HC.png new file mode 100644 index 0000000..5d6a9ca --- /dev/null +++ b/compound/screenshots/Compound Semantic Colors - Light HC.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:839c723275dcbcb24a305734da6018b9d1208d4d891aa39d8ff0687a381026d2 +size 393780 diff --git a/compound/screenshots/Compound Semantic Colors - Light.png b/compound/screenshots/Compound Semantic Colors - Light.png index 057e89e..ab6d4a9 100644 --- a/compound/screenshots/Compound Semantic Colors - Light.png +++ b/compound/screenshots/Compound Semantic Colors - Light.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:902a25c104b63b276d4636b3b82def05d0e995ed67ab3ab17785d1415e1025df -size 301008 +oid sha256:1a404aa0137f3708d142c17ad8e653c527f73df80a458d5266d467cde21a9bf5 +size 393497 diff --git a/compound/screenshots/Material3 Colors - Dark HC.png b/compound/screenshots/Material3 Colors - Dark HC.png new file mode 100644 index 0000000..5c523a1 --- /dev/null +++ b/compound/screenshots/Material3 Colors - Dark HC.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:417cd3a3d4cd2783db8d7e4da1abb4f78c7e57aeb1e19be007f5c0a729bf48fc +size 160784 diff --git a/compound/screenshots/Material3 Colors - Light HC.png b/compound/screenshots/Material3 Colors - Light HC.png new file mode 100644 index 0000000..4456b68 --- /dev/null +++ b/compound/screenshots/Material3 Colors - Light HC.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b0d74527159822754d13e729f8656a2fab9e2ae5786417a52db7076574d015b +size 163329 diff --git a/compound/src/main/kotlin/io/element/android/compound/theme/MaterialThemeColors.kt b/compound/src/main/kotlin/io/element/android/compound/theme/MaterialThemeColors.kt index c321fce..3f40589 100644 --- a/compound/src/main/kotlin/io/element/android/compound/theme/MaterialThemeColors.kt +++ b/compound/src/main/kotlin/io/element/android/compound/theme/MaterialThemeColors.kt @@ -25,6 +25,8 @@ import androidx.compose.ui.tooling.preview.Preview import io.element.android.compound.annotations.CoreColorToken import io.element.android.compound.previews.ColorsSchemePreview import io.element.android.compound.tokens.generated.SemanticColors +import io.element.android.compound.tokens.generated.compoundColorsHcDark +import io.element.android.compound.tokens.generated.compoundColorsHcLight import io.element.android.compound.tokens.generated.internal.DarkColorTokens import io.element.android.compound.tokens.generated.internal.LightColorTokens @@ -109,7 +111,34 @@ internal fun ColorsSchemeLightPreview() = ElementTheme { @Preview(heightDp = 1200) @Composable -internal fun ColorsSchemeDarkPreview() = ElementTheme(darkTheme = true) { +internal fun ColorsSchemeLightHcPreview() = ElementTheme( + compoundLight = compoundColorsHcLight, +) { + ColorsSchemePreview( + Color.Black, + Color.White, + ElementTheme.materialColors, + ) +} + +@Preview(heightDp = 1200) +@Composable +internal fun ColorsSchemeDarkPreview() = ElementTheme( + darkTheme = true, +) { + ColorsSchemePreview( + Color.White, + Color.Black, + ElementTheme.materialColors, + ) +} + +@Preview(heightDp = 1200) +@Composable +internal fun ColorsSchemeDarkHcPreview() = ElementTheme( + darkTheme = true, + compoundDark = compoundColorsHcDark, +) { ColorsSchemePreview( Color.White, Color.Black, diff --git a/compound/src/test/kotlin/io/element/android/compound/screenshot/MaterialColorSchemeTests.kt b/compound/src/test/kotlin/io/element/android/compound/screenshot/MaterialColorSchemeTests.kt index 90b0c27..79fd3be 100644 --- a/compound/src/test/kotlin/io/element/android/compound/screenshot/MaterialColorSchemeTests.kt +++ b/compound/src/test/kotlin/io/element/android/compound/screenshot/MaterialColorSchemeTests.kt @@ -13,9 +13,12 @@ import androidx.compose.ui.unit.sp import androidx.test.ext.junit.runners.AndroidJUnit4 import com.github.takahirom.roborazzi.captureRoboImage import io.element.android.compound.screenshot.utils.screenshotFile +import io.element.android.compound.theme.ColorsSchemeDarkHcPreview import io.element.android.compound.theme.ColorsSchemeDarkPreview +import io.element.android.compound.theme.ColorsSchemeLightHcPreview import io.element.android.compound.theme.ColorsSchemeLightPreview import io.element.android.compound.theme.ElementTheme +import io.element.android.compound.tokens.generated.compoundColorsHcLight import org.junit.Test import org.junit.runner.RunWith import org.robolectric.annotation.Config @@ -41,6 +44,20 @@ class MaterialColorSchemeTests { } } } + captureRoboImage(file = screenshotFile("Material3 Colors - Light HC.png")) { + ElementTheme { + Surface { + Column(modifier = Modifier.padding(16.dp)) { + Text( + text = "M3 Light HC colors", + style = TextStyle.Default.copy(fontSize = 18.sp), + ) + Spacer(modifier = Modifier.height(12.dp)) + ColorsSchemeLightHcPreview() + } + } + } + } captureRoboImage(file = screenshotFile("Material3 Colors - Dark.png")) { ElementTheme { Surface { @@ -55,5 +72,19 @@ class MaterialColorSchemeTests { } } } + captureRoboImage(file = screenshotFile("Material3 Colors - Dark HC.png")) { + ElementTheme { + Surface { + Column(modifier = Modifier.padding(16.dp)) { + Text( + text = "M3 Dark HC colors", + style = TextStyle.Default.copy(fontSize = 18.sp), + ) + Spacer(modifier = Modifier.height(12.dp)) + ColorsSchemeDarkHcPreview() + } + } + } + } } } diff --git a/compound/src/test/kotlin/io/element/android/compound/screenshot/SemanticColorsTests.kt b/compound/src/test/kotlin/io/element/android/compound/screenshot/SemanticColorsTests.kt index 61c189e..6d8e309 100644 --- a/compound/src/test/kotlin/io/element/android/compound/screenshot/SemanticColorsTests.kt +++ b/compound/src/test/kotlin/io/element/android/compound/screenshot/SemanticColorsTests.kt @@ -14,7 +14,9 @@ import com.github.takahirom.roborazzi.captureRoboImage import io.element.android.compound.previews.ColorListPreview import io.element.android.compound.screenshot.utils.screenshotFile import io.element.android.compound.theme.ElementTheme -import kotlinx.collections.immutable.toImmutableMap +import io.element.android.compound.tokens.generated.compoundColorsHcDark +import kotlinx.collections.immutable.ImmutableMap +import kotlinx.collections.immutable.persistentMapOf import org.junit.Test import org.junit.runner.RunWith import org.robolectric.annotation.Config @@ -23,7 +25,7 @@ import org.robolectric.annotation.GraphicsMode @RunWith(AndroidJUnit4::class) @GraphicsMode(GraphicsMode.Mode.NATIVE) class SemanticColorsTests { - @Config(sdk = [34], qualifiers = "h2048dp-xhdpi") + @Config(sdk = [34], qualifiers = "h2500dp-xhdpi") @Test fun screenshots() { captureRoboImage(file = screenshotFile("Compound Semantic Colors - Light.png")) { @@ -37,7 +39,27 @@ class SemanticColorsTests { ColorListPreview( backgroundColor = Color.White, foregroundColor = Color.Black, - colors = getSemanticColors().toMap().toImmutableMap() + colors = getSemanticColors(), + ) + } + } + } + } + + captureRoboImage(file = screenshotFile("Compound Semantic Colors - Light HC.png")) { + ElementTheme( + compoundDark = compoundColorsHcDark, + ) { + Surface { + Column( + modifier = Modifier.padding(16.dp), + verticalArrangement = Arrangement.spacedBy(10.dp) + ) { + Text("Compound Semantic Colors - Light HC") + ColorListPreview( + backgroundColor = Color.White, + foregroundColor = Color.Black, + colors = getSemanticColors() ) } } @@ -55,7 +77,28 @@ class SemanticColorsTests { ColorListPreview( backgroundColor = Color.White, foregroundColor = Color.Black, - colors = getSemanticColors().toMap().toImmutableMap() + colors = getSemanticColors(), + ) + } + } + } + } + + captureRoboImage(file = screenshotFile("Compound Semantic Colors - Dark HC.png")) { + ElementTheme( + darkTheme = true, + compoundDark = compoundColorsHcDark, + ) { + Surface { + Column( + modifier = Modifier.padding(16.dp), + verticalArrangement = Arrangement.spacedBy(10.dp) + ) { + Text("Compound Semantic Colors - Dark HC") + ColorListPreview( + backgroundColor = Color.White, + foregroundColor = Color.Black, + colors = getSemanticColors() ) } } @@ -64,9 +107,12 @@ class SemanticColorsTests { } @Composable - private fun getSemanticColors(): List> { + private fun getSemanticColors(): ImmutableMap { return with(ElementTheme.colors) { - listOf( + persistentMapOf( + "bgAccentHovered" to bgAccentHovered, + "bgAccentPressed" to bgAccentPressed, + "bgAccentRest" to bgAccentRest, "bgActionPrimaryDisabled" to bgActionPrimaryDisabled, "bgActionPrimaryHovered" to bgActionPrimaryHovered, "bgActionPrimaryPressed" to bgActionPrimaryPressed, @@ -80,6 +126,12 @@ class SemanticColorsTests { "bgCriticalPrimary" to bgCriticalPrimary, "bgCriticalSubtle" to bgCriticalSubtle, "bgCriticalSubtleHovered" to bgCriticalSubtleHovered, + "bgDecorative1" to bgDecorative1, + "bgDecorative2" to bgDecorative2, + "bgDecorative3" to bgDecorative3, + "bgDecorative4" to bgDecorative4, + "bgDecorative5" to bgDecorative5, + "bgDecorative6" to bgDecorative6, "bgInfoSubtle" to bgInfoSubtle, "bgSubtlePrimary" to bgSubtlePrimary, "bgSubtleSecondary" to bgSubtleSecondary, @@ -94,6 +146,7 @@ class SemanticColorsTests { "borderInteractivePrimary" to borderInteractivePrimary, "borderInteractiveSecondary" to borderInteractiveSecondary, "borderSuccessSubtle" to borderSuccessSubtle, + "iconAccentPrimary" to iconAccentPrimary, "iconAccentTertiary" to iconAccentTertiary, "iconCriticalPrimary" to iconCriticalPrimary, "iconDisabled" to iconDisabled, @@ -111,6 +164,12 @@ class SemanticColorsTests { "textActionAccent" to textActionAccent, "textActionPrimary" to textActionPrimary, "textCriticalPrimary" to textCriticalPrimary, + "textDecorative1" to textDecorative1, + "textDecorative2" to textDecorative2, + "textDecorative3" to textDecorative3, + "textDecorative4" to textDecorative4, + "textDecorative5" to textDecorative5, + "textDecorative6" to textDecorative6, "textDisabled" to textDisabled, "textInfoPrimary" to textInfoPrimary, "textLinkExternal" to textLinkExternal, @@ -119,6 +178,7 @@ class SemanticColorsTests { "textPrimary" to textPrimary, "textSecondary" to textSecondary, "textSuccessPrimary" to textSuccessPrimary, + "isLight" to if (isLight) Color.White else Color.Black, ) } }