Skip to content

Commit

Permalink
Merge pull request #56 from element-hq/version-0.0.7
Browse files Browse the repository at this point in the history
Version 0.0.7
  • Loading branch information
bmarty authored Jul 4, 2024
2 parents ab12ae9 + 4623e7d commit 7d73846
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
2 changes: 1 addition & 1 deletion compound/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
3 changes: 3 additions & 0 deletions compound/screenshots/Compound Semantic Colors - Dark HC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions compound/screenshots/Compound Semantic Colors - Dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions compound/screenshots/Compound Semantic Colors - Light HC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions compound/screenshots/Compound Semantic Colors - Light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions compound/screenshots/Material3 Colors - Dark HC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions compound/screenshots/Material3 Colors - Light HC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -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()
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")) {
Expand All @@ -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()
)
}
}
Expand All @@ -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()
)
}
}
Expand All @@ -64,9 +107,12 @@ class SemanticColorsTests {
}

@Composable
private fun getSemanticColors(): List<Pair<String, Color>> {
private fun getSemanticColors(): ImmutableMap<String, Color> {
return with(ElementTheme.colors) {
listOf(
persistentMapOf(
"bgAccentHovered" to bgAccentHovered,
"bgAccentPressed" to bgAccentPressed,
"bgAccentRest" to bgAccentRest,
"bgActionPrimaryDisabled" to bgActionPrimaryDisabled,
"bgActionPrimaryHovered" to bgActionPrimaryHovered,
"bgActionPrimaryPressed" to bgActionPrimaryPressed,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -119,6 +178,7 @@ class SemanticColorsTests {
"textPrimary" to textPrimary,
"textSecondary" to textSecondary,
"textSuccessPrimary" to textSuccessPrimary,
"isLight" to if (isLight) Color.White else Color.Black,
)
}
}
Expand Down

0 comments on commit 7d73846

Please sign in to comment.