Skip to content

Commit

Permalink
Update tokens too
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinesp committed Apr 5, 2024
1 parent 932f45b commit 768a75c
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ internal val compoundColorsLight = SemanticColors(
iconSuccessPrimary = LightColorTokens.colorGreen900,
iconInfoPrimary = LightColorTokens.colorBlue900,
iconOnSolidPrimary = LightColorTokens.colorThemeBg,
bgAccentRest = LightColorTokens.colorGreen900,
bgAccentHovered = LightColorTokens.colorGreen1000,
bgAccentPressed = LightColorTokens.colorGreen1100,
bgDecorative1 = LightColorTokens.colorLime300,
bgDecorative2 = LightColorTokens.colorCyan300,
bgDecorative3 = LightColorTokens.colorFuchsia300,
bgDecorative4 = LightColorTokens.colorPurple300,
bgDecorative5 = LightColorTokens.colorPink300,
bgDecorative6 = LightColorTokens.colorOrange300,
textDecorative1 = LightColorTokens.colorLime1100,
textDecorative2 = LightColorTokens.colorCyan1100,
textDecorative3 = LightColorTokens.colorFuchsia1100,
textDecorative4 = LightColorTokens.colorPurple1100,
textDecorative5 = LightColorTokens.colorPink1100,
textDecorative6 = LightColorTokens.colorOrange1100,
isLight = true,
)

Expand Down Expand Up @@ -133,5 +148,20 @@ internal val compoundColorsDark = SemanticColors(
iconSuccessPrimary = DarkColorTokens.colorGreen900,
iconInfoPrimary = DarkColorTokens.colorBlue900,
iconOnSolidPrimary = DarkColorTokens.colorThemeBg,
bgAccentRest = LightColorTokens.colorGreen900,
bgAccentHovered = LightColorTokens.colorGreen1000,
bgAccentPressed = LightColorTokens.colorGreen1100,
bgDecorative1 = LightColorTokens.colorLime300,
bgDecorative2 = LightColorTokens.colorCyan300,
bgDecorative3 = LightColorTokens.colorFuchsia300,
bgDecorative4 = LightColorTokens.colorPurple300,
bgDecorative5 = LightColorTokens.colorPink300,
bgDecorative6 = LightColorTokens.colorOrange300,
textDecorative1 = LightColorTokens.colorLime1100,
textDecorative2 = LightColorTokens.colorCyan1100,
textDecorative3 = LightColorTokens.colorFuchsia1100,
textDecorative4 = LightColorTokens.colorPurple1100,
textDecorative5 = LightColorTokens.colorPink1100,
textDecorative6 = LightColorTokens.colorOrange1100,
isLight = false,
)
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ object CompoundIcons {
@Composable fun TakePhoto(): ImageVector {
return ImageVector.vectorResource(R.drawable.ic_compound_take_photo)
}
@Composable fun TakePhotoSolid(): ImageVector {
return ImageVector.vectorResource(R.drawable.ic_compound_take_photo_solid)
}
@Composable fun TextFormatting(): ImageVector {
return ImageVector.vectorResource(R.drawable.ic_compound_text_formatting)
}
Expand Down Expand Up @@ -521,7 +524,7 @@ object CompoundIcons {
return ImageVector.vectorResource(R.drawable.ic_compound_web_browser)
}

val all @Composable get() = persistentListOf(
val all @Composable get() = persistentListOf<ImageVector>(
Admin(),
ArrowDown(),
ArrowLeft(),
Expand Down Expand Up @@ -658,6 +661,7 @@ object CompoundIcons {
Strikethrough(),
SwitchCameraSolid(),
TakePhoto(),
TakePhotoSolid(),
TextFormatting(),
Threads(),
ThreadsSolid(),
Expand Down Expand Up @@ -826,6 +830,7 @@ object CompoundIcons {
R.drawable.ic_compound_strikethrough,
R.drawable.ic_compound_switch_camera_solid,
R.drawable.ic_compound_take_photo,
R.drawable.ic_compound_take_photo_solid,
R.drawable.ic_compound_text_formatting,
R.drawable.ic_compound_threads,
R.drawable.ic_compound_threads_solid,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 New Vector Ltd
* Copyright (c) 2024 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,9 @@ import androidx.compose.ui.graphics.Color
*/
@Stable
class SemanticColors(
bgAccentHovered: Color,
bgAccentPressed: Color,
bgAccentRest: Color,
bgActionPrimaryDisabled: Color,
bgActionPrimaryHovered: Color,
bgActionPrimaryPressed: Color,
Expand All @@ -45,6 +48,12 @@ class SemanticColors(
bgCriticalPrimary: Color,
bgCriticalSubtle: Color,
bgCriticalSubtleHovered: Color,
bgDecorative1: Color,
bgDecorative2: Color,
bgDecorative3: Color,
bgDecorative4: Color,
bgDecorative5: Color,
bgDecorative6: Color,
bgInfoSubtle: Color,
bgSubtlePrimary: Color,
bgSubtleSecondary: Color,
Expand Down Expand Up @@ -76,6 +85,12 @@ class SemanticColors(
textActionAccent: Color,
textActionPrimary: Color,
textCriticalPrimary: Color,
textDecorative1: Color,
textDecorative2: Color,
textDecorative3: Color,
textDecorative4: Color,
textDecorative5: Color,
textDecorative6: Color,
textDisabled: Color,
textInfoPrimary: Color,
textLinkExternal: Color,
Expand All @@ -88,6 +103,15 @@ class SemanticColors(
) {
var isLight by mutableStateOf(isLight)
private set
/** Background colour for accent or brand actions. State: Hover */
var bgAccentHovered by mutableStateOf(bgAccentHovered)
private set
/** Background colour for accent or brand actions. State: Pressed */
var bgAccentPressed by mutableStateOf(bgAccentPressed)
private set
/** Background colour for accent or brand actions. State: Rest. */
var bgAccentRest by mutableStateOf(bgAccentRest)
private set
/** Background colour for primary actions. State: Disabled. */
var bgActionPrimaryDisabled by mutableStateOf(bgActionPrimaryDisabled)
private set
Expand Down Expand Up @@ -128,6 +152,24 @@ Elevation: Default (Level 0) */
/** Default subtle critical surfaces. State: Hover. */
var bgCriticalSubtleHovered by mutableStateOf(bgCriticalSubtleHovered)
private set
/** Decorative background (1, Lime) for avatars and usernames. */
var bgDecorative1 by mutableStateOf(bgDecorative1)
private set
/** Decorative background (2, Cyan) for avatars and usernames. */
var bgDecorative2 by mutableStateOf(bgDecorative2)
private set
/** Decorative background (3, Fuchsia) for avatars and usernames. */
var bgDecorative3 by mutableStateOf(bgDecorative3)
private set
/** Decorative background (4, Purple) for avatars and usernames. */
var bgDecorative4 by mutableStateOf(bgDecorative4)
private set
/** Decorative background (5, Pink) for avatars and usernames. */
var bgDecorative5 by mutableStateOf(bgDecorative5)
private set
/** Decorative background (6, Orange) for avatars and usernames. */
var bgDecorative6 by mutableStateOf(bgDecorative6)
private set
/** Subtle background colour for informational elements. State: Rest. */
var bgInfoSubtle by mutableStateOf(bgInfoSubtle)
private set
Expand Down Expand Up @@ -223,6 +265,24 @@ Elevation: Default (Level 1). */
/** Text colour for destructive plain actions. */
var textCriticalPrimary by mutableStateOf(textCriticalPrimary)
private set
/** Decorative text colour (1, Lime) for avatars and usernames. */
var textDecorative1 by mutableStateOf(textDecorative1)
private set
/** Decorative text colour (2, Cyan) for avatars and usernames. */
var textDecorative2 by mutableStateOf(textDecorative2)
private set
/** Decorative text colour (3, Fuchsia) for avatars and usernames. */
var textDecorative3 by mutableStateOf(textDecorative3)
private set
/** Decorative text colour (4, Purple) for avatars and usernames. */
var textDecorative4 by mutableStateOf(textDecorative4)
private set
/** Decorative text colour (5, Pink) for avatars and usernames. */
var textDecorative5 by mutableStateOf(textDecorative5)
private set
/** Decorative text colour (6, Orange) for avatars and usernames. */
var textDecorative6 by mutableStateOf(textDecorative6)
private set
/** Use for regular text in disabled elements. There's no minimum contrast requirement. */
var textDisabled by mutableStateOf(textDisabled)
private set
Expand All @@ -249,6 +309,9 @@ Elevation: Default (Level 1). */
private set

fun copy(
bgAccentHovered: Color = this.bgAccentHovered,
bgAccentPressed: Color = this.bgAccentPressed,
bgAccentRest: Color = this.bgAccentRest,
bgActionPrimaryDisabled: Color = this.bgActionPrimaryDisabled,
bgActionPrimaryHovered: Color = this.bgActionPrimaryHovered,
bgActionPrimaryPressed: Color = this.bgActionPrimaryPressed,
Expand All @@ -262,6 +325,12 @@ Elevation: Default (Level 1). */
bgCriticalPrimary: Color = this.bgCriticalPrimary,
bgCriticalSubtle: Color = this.bgCriticalSubtle,
bgCriticalSubtleHovered: Color = this.bgCriticalSubtleHovered,
bgDecorative1: Color = this.bgDecorative1,
bgDecorative2: Color = this.bgDecorative2,
bgDecorative3: Color = this.bgDecorative3,
bgDecorative4: Color = this.bgDecorative4,
bgDecorative5: Color = this.bgDecorative5,
bgDecorative6: Color = this.bgDecorative6,
bgInfoSubtle: Color = this.bgInfoSubtle,
bgSubtlePrimary: Color = this.bgSubtlePrimary,
bgSubtleSecondary: Color = this.bgSubtleSecondary,
Expand Down Expand Up @@ -293,6 +362,12 @@ Elevation: Default (Level 1). */
textActionAccent: Color = this.textActionAccent,
textActionPrimary: Color = this.textActionPrimary,
textCriticalPrimary: Color = this.textCriticalPrimary,
textDecorative1: Color = this.textDecorative1,
textDecorative2: Color = this.textDecorative2,
textDecorative3: Color = this.textDecorative3,
textDecorative4: Color = this.textDecorative4,
textDecorative5: Color = this.textDecorative5,
textDecorative6: Color = this.textDecorative6,
textDisabled: Color = this.textDisabled,
textInfoPrimary: Color = this.textInfoPrimary,
textLinkExternal: Color = this.textLinkExternal,
Expand All @@ -303,6 +378,9 @@ Elevation: Default (Level 1). */
textSuccessPrimary: Color = this.textSuccessPrimary,
isLight: Boolean = this.isLight,
) = SemanticColors(
bgAccentHovered = bgAccentHovered,
bgAccentPressed = bgAccentPressed,
bgAccentRest = bgAccentRest,
bgActionPrimaryDisabled = bgActionPrimaryDisabled,
bgActionPrimaryHovered = bgActionPrimaryHovered,
bgActionPrimaryPressed = bgActionPrimaryPressed,
Expand All @@ -316,6 +394,12 @@ Elevation: Default (Level 1). */
bgCriticalPrimary = bgCriticalPrimary,
bgCriticalSubtle = bgCriticalSubtle,
bgCriticalSubtleHovered = bgCriticalSubtleHovered,
bgDecorative1 = bgDecorative1,
bgDecorative2 = bgDecorative2,
bgDecorative3 = bgDecorative3,
bgDecorative4 = bgDecorative4,
bgDecorative5 = bgDecorative5,
bgDecorative6 = bgDecorative6,
bgInfoSubtle = bgInfoSubtle,
bgSubtlePrimary = bgSubtlePrimary,
bgSubtleSecondary = bgSubtleSecondary,
Expand Down Expand Up @@ -347,6 +431,12 @@ Elevation: Default (Level 1). */
textActionAccent = textActionAccent,
textActionPrimary = textActionPrimary,
textCriticalPrimary = textCriticalPrimary,
textDecorative1 = textDecorative1,
textDecorative2 = textDecorative2,
textDecorative3 = textDecorative3,
textDecorative4 = textDecorative4,
textDecorative5 = textDecorative5,
textDecorative6 = textDecorative6,
textDisabled = textDisabled,
textInfoPrimary = textInfoPrimary,
textLinkExternal = textLinkExternal,
Expand All @@ -359,6 +449,9 @@ Elevation: Default (Level 1). */
)

fun updateColorsFrom(other: SemanticColors) {
bgAccentHovered = other.bgAccentHovered
bgAccentPressed = other.bgAccentPressed
bgAccentRest = other.bgAccentRest
bgActionPrimaryDisabled = other.bgActionPrimaryDisabled
bgActionPrimaryHovered = other.bgActionPrimaryHovered
bgActionPrimaryPressed = other.bgActionPrimaryPressed
Expand All @@ -372,6 +465,12 @@ Elevation: Default (Level 1). */
bgCriticalPrimary = other.bgCriticalPrimary
bgCriticalSubtle = other.bgCriticalSubtle
bgCriticalSubtleHovered = other.bgCriticalSubtleHovered
bgDecorative1 = other.bgDecorative1
bgDecorative2 = other.bgDecorative2
bgDecorative3 = other.bgDecorative3
bgDecorative4 = other.bgDecorative4
bgDecorative5 = other.bgDecorative5
bgDecorative6 = other.bgDecorative6
bgInfoSubtle = other.bgInfoSubtle
bgSubtlePrimary = other.bgSubtlePrimary
bgSubtleSecondary = other.bgSubtleSecondary
Expand Down Expand Up @@ -403,6 +502,12 @@ Elevation: Default (Level 1). */
textActionAccent = other.textActionAccent
textActionPrimary = other.textActionPrimary
textCriticalPrimary = other.textCriticalPrimary
textDecorative1 = other.textDecorative1
textDecorative2 = other.textDecorative2
textDecorative3 = other.textDecorative3
textDecorative4 = other.textDecorative4
textDecorative5 = other.textDecorative5
textDecorative6 = other.textDecorative6
textDisabled = other.textDisabled
textInfoPrimary = other.textInfoPrimary
textLinkExternal = other.textLinkExternal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 New Vector Ltd
* Copyright (c) 2024 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 New Vector Ltd
* Copyright (c) 2024 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 New Vector Ltd
* Copyright (c) 2024 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
10 changes: 10 additions & 0 deletions compound/src/main/res/drawable/ic_compound_take_photo_solid.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:fillType="evenOdd"
android:pathData="M2.59 20.41C2.98 20.81 3.45 21 4 21h16c0.55 0 1.02-0.2 1.41-0.59A1.93 1.93 0 0 0 22 19V7c0-0.55-0.2-1.02-0.59-1.41A1.93 1.93 0 0 0 20 5h-3.15L15.6 3.65a2 2 0 0 0-0.66-0.47A1.95 1.95 0 0 0 14.12 3H9.87A2.01 2.01 0 0 0 8.4 3.65L7.15 5H4C3.45 5 2.98 5.2 2.59 5.59A1.93 1.93 0 0 0 2 7v12c0 0.55 0.2 1.02 0.59 1.41ZM12 16.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Z"/>
</vector>

0 comments on commit 768a75c

Please sign in to comment.