Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-23 13:13:02 +03:00
parent f4fa13627c
commit 68615198ae
7 changed files with 905 additions and 36 deletions

View file

@ -20,6 +20,7 @@ object TangemColorPalette {
// region Light
val Light1 = Color(0xFFF5F5F5)
val Light1V2 = Color(0xFFF4F4F4)
val Light2 = Color(0xFFEBEBEB)
val Light3 = Color(0xFFD3D3D3)
val Light4 = Color(0xFFC9C9C9)
@ -27,6 +28,7 @@ object TangemColorPalette {
// endregion Light
// region Green
val Green = Color(0xFF0C9F3D)
val Meadow = Color(0xFF1ACE80)
val MagicMint = Color(0xFFA3EBCC)
val DarkGreen = Color(0xFF06311F)
@ -45,4 +47,9 @@ object TangemColorPalette {
val Tangerine = Color(0xFFFFB71B)
val Mustard = Color(0xFFFDDE55)
// endregion Yellow
// region Overlay
val Overlay1 = Color(0x66000000)
val Overlay2 = Color(0xB2000000)
// endregion Overlay
}

View file

@ -0,0 +1,536 @@
@file:Suppress("LongParameterList")
package com.tangem.core.ui.res
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
@Stable
class TangemColors2 internal constructor(
val text: Text,
val graphic: Graphic,
val button: Button,
val surface: Surface,
val controls: Controls,
val field: Field,
val overlay: Overlay,
val border: Border,
val fill: Fill,
val skeleton: Skeleton,
val markers: Markers,
) {
@Stable
class Text internal constructor(
val neutral: Neutral,
val status: Status,
) {
@Stable
class Neutral internal constructor(
primary: Color,
primaryInverted: Color,
secondary: Color,
tertiary: Color,
primaryInvertedConstant: Color,
) {
var primary by mutableStateOf(primary)
private set
var primaryInverted by mutableStateOf(primaryInverted)
private set
var secondary by mutableStateOf(secondary)
private set
var tertiary by mutableStateOf(tertiary)
private set
var primaryInvertedConstant by mutableStateOf(primaryInvertedConstant)
private set
fun update(other: Neutral) {
primary = other.primary
primaryInverted = other.primaryInverted
secondary = other.secondary
tertiary = other.tertiary
primaryInvertedConstant = other.primaryInvertedConstant
}
}
@Stable
class Status internal constructor(
disabled: Color,
accent: Color,
warning: Color,
attention: Color,
positive: Color,
) {
var disabled by mutableStateOf(disabled)
private set
var accent by mutableStateOf(accent)
private set
var warning by mutableStateOf(warning)
private set
var attention by mutableStateOf(attention)
private set
var positive by mutableStateOf(positive)
private set
fun update(other: Status) {
disabled = other.disabled
accent = other.accent
warning = other.warning
attention = other.attention
positive = other.positive
}
}
fun update(other: Text) {
neutral.update(other.neutral)
status.update(other.status)
}
}
@Stable
class Graphic internal constructor(
val neutral: Neutral,
val status: Status,
) {
@Stable
class Neutral internal constructor(
primary: Color,
primaryInverted: Color,
secondary: Color,
tertiary: Color,
quaternary: Color,
primaryInvertedConstant: Color,
tertiaryConstant: Color,
) {
var primary by mutableStateOf(primary)
private set
var primaryInverted by mutableStateOf(primaryInverted)
private set
var secondary by mutableStateOf(secondary)
private set
var tertiary by mutableStateOf(tertiary)
private set
var quaternary by mutableStateOf(quaternary)
private set
var primaryInvertedConstant by mutableStateOf(primaryInvertedConstant)
private set
var tertiaryConstant by mutableStateOf(tertiaryConstant)
private set
fun update(other: Neutral) {
primary = other.primary
primaryInverted = other.primaryInverted
secondary = other.secondary
tertiary = other.tertiary
quaternary = other.quaternary
primaryInvertedConstant = other.primaryInvertedConstant
tertiaryConstant = other.tertiaryConstant
}
}
@Stable
class Status internal constructor(
accent: Color,
warning: Color,
attention: Color,
) {
var accent by mutableStateOf(accent)
private set
var warning by mutableStateOf(warning)
private set
var attention by mutableStateOf(attention)
private set
fun update(other: Status) {
accent = other.accent
warning = other.warning
attention = other.attention
}
}
fun update(other: Graphic) {
neutral.update(other.neutral)
status.update(other.status)
}
}
@Stable
class Button internal constructor(
backgroundPrimary: Color,
backgroundSecondary: Color,
backgroundDisabled: Color,
backgroundPositive: Color,
textPrimary: Color,
textSecondary: Color,
textDisabled: Color,
iconPrimary: Color,
iconSecondary: Color,
iconDisabled: Color,
borderPrimary: Color,
) {
var backgroundPrimary by mutableStateOf(backgroundPrimary)
private set
var backgroundSecondary by mutableStateOf(backgroundSecondary)
private set
var backgroundDisabled by mutableStateOf(backgroundDisabled)
private set
var backgroundPositive by mutableStateOf(backgroundPositive)
private set
var textPrimary by mutableStateOf(textPrimary)
private set
var textSecondary by mutableStateOf(textSecondary)
private set
var textDisabled by mutableStateOf(textDisabled)
private set
var iconPrimary by mutableStateOf(iconPrimary)
private set
var iconSecondary by mutableStateOf(iconSecondary)
private set
var iconDisabled by mutableStateOf(iconDisabled)
private set
var borderPrimary by mutableStateOf(borderPrimary)
private set
fun update(other: Button) {
backgroundPrimary = other.backgroundPrimary
backgroundSecondary = other.backgroundSecondary
backgroundDisabled = other.backgroundDisabled
backgroundPositive = other.backgroundPositive
textPrimary = other.textPrimary
textSecondary = other.textSecondary
textDisabled = other.textDisabled
iconPrimary = other.iconPrimary
iconSecondary = other.iconSecondary
iconDisabled = other.iconDisabled
borderPrimary = other.borderPrimary
}
}
@Stable
class Surface internal constructor(
level1: Color,
level2: Color,
level3: Color,
level4: Color,
) {
var level1 by mutableStateOf(level1)
private set
var level2 by mutableStateOf(level2)
private set
var level3 by mutableStateOf(level3)
private set
var level4 by mutableStateOf(level4)
private set
fun update(other: Surface) {
level1 = other.level1
level2 = other.level2
level3 = other.level3
level4 = other.level4
}
}
@Stable
class Controls internal constructor(
backgroundDefault: Color,
backgroundChecked: Color,
iconDefault: Color,
iconDisabled: Color,
) {
var backgroundDefault by mutableStateOf(backgroundDefault)
private set
var backgroundChecked by mutableStateOf(backgroundChecked)
private set
var iconDefault by mutableStateOf(iconDefault)
private set
var iconDisabled by mutableStateOf(iconDisabled)
private set
fun update(other: Controls) {
backgroundDefault = other.backgroundDefault
backgroundChecked = other.backgroundChecked
iconDefault = other.iconDefault
iconDisabled = other.iconDisabled
}
}
@Stable
class Field internal constructor(
backgroundDefault: Color,
backgroundFocused: Color,
textPlaceholder: Color,
textDefault: Color,
textDisabled: Color,
iconDefault: Color,
iconDisabled: Color,
textInvalid: Color,
borderInvalid: Color,
) {
var backgroundDefault by mutableStateOf(backgroundDefault)
private set
var backgroundFocused by mutableStateOf(backgroundFocused)
private set
var textPlaceholder by mutableStateOf(textPlaceholder)
private set
var textDefault by mutableStateOf(textDefault)
private set
var textDisabled by mutableStateOf(textDisabled)
private set
var iconDefault by mutableStateOf(iconDefault)
private set
var iconDisabled by mutableStateOf(iconDisabled)
private set
var textInvalid by mutableStateOf(textInvalid)
private set
var borderInvalid by mutableStateOf(borderInvalid)
private set
fun update(other: Field) {
backgroundDefault = other.backgroundDefault
backgroundFocused = other.backgroundFocused
textPlaceholder = other.textPlaceholder
textDefault = other.textDefault
textDisabled = other.textDisabled
iconDefault = other.iconDefault
iconDisabled = other.iconDisabled
textInvalid = other.textInvalid
borderInvalid = other.borderInvalid
}
}
@Stable
class Overlay internal constructor(
overlayPrimary: Color,
overlaySecondary: Color,
) {
var overlayPrimary by mutableStateOf(overlayPrimary)
private set
var overlaySecondary by mutableStateOf(overlaySecondary)
private set
fun update(other: Overlay) {
overlayPrimary = other.overlayPrimary
overlaySecondary = other.overlaySecondary
}
}
@Stable
class Border internal constructor(
val neutral: Neutral,
val status: Status,
) {
@Stable
class Neutral internal constructor(
primary: Color,
secondary: Color,
) {
var primary by mutableStateOf(primary)
private set
var secondary by mutableStateOf(secondary)
private set
fun update(other: Neutral) {
primary = other.primary
secondary = other.secondary
}
}
@Stable
class Status internal constructor(
accent: Color,
warning: Color,
attention: Color,
) {
var accent by mutableStateOf(accent)
private set
var warning by mutableStateOf(warning)
private set
var attention by mutableStateOf(attention)
private set
fun update(other: Status) {
accent = other.accent
warning = other.warning
attention = other.attention
}
}
fun update(other: Border) {
neutral.update(other.neutral)
status.update(other.status)
}
}
@Stable
class Fill internal constructor(
val neutral: Neutral,
val status: Status,
) {
@Stable
class Neutral internal constructor(
primary: Color,
primaryInverted: Color,
primaryInvertedConstant: Color,
secondary: Color,
tertiaryConstant: Color,
quaternary: Color,
) {
var primary by mutableStateOf(primary)
private set
var primaryInverted by mutableStateOf(primaryInverted)
private set
var primaryInvertedConstant by mutableStateOf(primaryInvertedConstant)
private set
var secondary by mutableStateOf(secondary)
private set
var tertiaryConstant by mutableStateOf(tertiaryConstant)
private set
var quaternary by mutableStateOf(quaternary)
private set
fun update(other: Neutral) {
primary = other.primary
primaryInverted = other.primaryInverted
primaryInvertedConstant = other.primaryInvertedConstant
secondary = other.secondary
tertiaryConstant = other.tertiaryConstant
quaternary = other.quaternary
}
}
@Stable
class Status internal constructor(
accent: Color,
warning: Color,
attention: Color,
) {
var accent by mutableStateOf(accent)
private set
var warning by mutableStateOf(warning)
private set
var attention by mutableStateOf(attention)
private set
fun update(other: Status) {
accent = other.accent
warning = other.warning
attention = other.attention
}
}
fun update(other: Fill) {
neutral.update(other.neutral)
status.update(other.status)
}
}
@Stable
class Skeleton internal constructor(
backgroundPrimary: Color,
) {
var backgroundPrimary by mutableStateOf(backgroundPrimary)
private set
fun update(other: Skeleton) {
backgroundPrimary = other.backgroundPrimary
}
}
@Stable
class Markers internal constructor(
backgroundSolidGray: Color,
backgroundDisabled: Color,
backgroundSolidBlue: Color,
textGray: Color,
textDisabled: Color,
iconGray: Color,
iconDisabled: Color,
borderGray: Color,
backgroundTintedBlue: Color,
textBlue: Color,
backgroundSolidRed: Color,
backgroundTintedRed: Color,
iconBlue: Color,
iconRed: Color,
textRed: Color,
backgroundTintedGray: Color,
borderTintedBlue: Color,
borderTintedRed: Color,
) {
var backgroundSolidGray by mutableStateOf(backgroundSolidGray)
private set
var backgroundDisabled by mutableStateOf(backgroundDisabled)
private set
var backgroundSolidBlue by mutableStateOf(backgroundSolidBlue)
private set
var textGray by mutableStateOf(textGray)
private set
var textDisabled by mutableStateOf(textDisabled)
private set
var iconGray by mutableStateOf(iconGray)
private set
var iconDisabled by mutableStateOf(iconDisabled)
private set
var borderGray by mutableStateOf(borderGray)
private set
var backgroundTintedBlue by mutableStateOf(backgroundTintedBlue)
private set
var textBlue by mutableStateOf(textBlue)
private set
var backgroundSolidRed by mutableStateOf(backgroundSolidRed)
private set
var backgroundTintedRed by mutableStateOf(backgroundTintedRed)
private set
var iconBlue by mutableStateOf(iconBlue)
private set
var iconRed by mutableStateOf(iconRed)
private set
var textRed by mutableStateOf(textRed)
private set
var backgroundTintedGray by mutableStateOf(backgroundTintedGray)
private set
var borderTintedBlue by mutableStateOf(borderTintedBlue)
private set
var borderTintedRed by mutableStateOf(borderTintedRed)
private set
fun update(other: Markers) {
backgroundSolidGray = other.backgroundSolidGray
backgroundDisabled = other.backgroundDisabled
backgroundSolidBlue = other.backgroundSolidBlue
textGray = other.textGray
textDisabled = other.textDisabled
iconGray = other.iconGray
iconDisabled = other.iconDisabled
borderGray = other.borderGray
backgroundTintedBlue = other.backgroundTintedBlue
textBlue = other.textBlue
backgroundSolidRed = other.backgroundSolidRed
backgroundTintedRed = other.backgroundTintedRed
iconBlue = other.iconBlue
iconRed = other.iconRed
textRed = other.textRed
backgroundTintedGray = other.backgroundTintedGray
borderTintedBlue = other.borderTintedBlue
borderTintedRed = other.borderTintedRed
}
}
fun update(other: TangemColors2) {
text.update(other.text)
graphic.update(other.graphic)
button.update(other.button)
surface.update(other.surface)
controls.update(other.controls)
field.update(other.field)
overlay.update(other.overlay)
border.update(other.border)
fill.update(other.fill)
skeleton.update(other.skeleton)
markers.update(other.markers)
}
}

View file

@ -138,6 +138,11 @@ object TangemTheme {
@ReadOnlyComposable
get() = LocalTangemColors.current
val colors2: TangemColors2
@Composable
@ReadOnlyComposable
get() = LocalTangemColors2.current
val typography: TangemTypography
@Composable
@ReadOnlyComposable
@ -156,7 +161,7 @@ object TangemTheme {
@Stable
@Composable
private fun tangemColorScheme(colors: TangemColors): ColorScheme {
internal fun tangemColorScheme(colors: TangemColors): ColorScheme {
return ColorScheme(
primary = colors.background.primary,
onPrimary = colors.text.primary1,
@ -206,7 +211,7 @@ private fun tangemColorScheme(colors: TangemColors): ColorScheme {
@Composable
@ReadOnlyComposable
private fun lightThemeColors(): TangemColors {
internal fun lightThemeColors(redesign: Boolean = false): TangemColors {
return TangemColors(
text = TangemColors.Text(
primary1 = TangemColorPalette.Dark6,
@ -233,8 +238,8 @@ private fun lightThemeColors(): TangemColors {
),
background = TangemColors.Background(
primary = TangemColorPalette.White,
secondary = TangemColorPalette.Light1,
tertiary = TangemColorPalette.Light1,
secondary = if (redesign) TangemColorPalette.Light1V2 else TangemColorPalette.Light1,
tertiary = if (redesign) TangemColorPalette.Light1V2 else TangemColorPalette.Light1,
action = TangemColorPalette.White,
),
control = TangemColors.Control(
@ -248,7 +253,7 @@ private fun lightThemeColors(): TangemColors {
transparency = TangemColorPalette.White,
),
field = TangemColors.Field(
primary = TangemColorPalette.Light1,
primary = if (redesign) TangemColorPalette.Light1V2 else TangemColorPalette.Light1,
focused = TangemColorPalette.Light2,
),
overlay = TangemColors.Overlay(
@ -260,7 +265,7 @@ private fun lightThemeColors(): TangemColors {
@Composable
@ReadOnlyComposable
private fun darkThemeColors(): TangemColors {
internal fun darkThemeColors(): TangemColors {
return TangemColors(
text = TangemColors.Text(
primary1 = TangemColorPalette.White,
@ -320,12 +325,16 @@ private val TangemTextSelectionColors: TextSelectionColors
backgroundColor = TangemTheme.colors.text.accent.copy(alpha = 0.3f),
)
private val LocalTangemColors = staticCompositionLocalOf<TangemColors> {
internal val LocalTangemColors = staticCompositionLocalOf<TangemColors> {
error("No TangemColors provided")
}
private val LocalTangemTypography = staticCompositionLocalOf {
TangemTypography()
internal val LocalTangemColors2 = staticCompositionLocalOf<TangemColors2> {
error("No TangemColors2 provided")
}
internal val LocalTangemTypography = staticCompositionLocalOf {
TangemTypography(RobotoFamily)
}
private val LocalTangemDimens = staticCompositionLocalOf {

View file

@ -0,0 +1,309 @@
@file:Suppress("LongMethod")
package com.tangem.core.ui.res
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.*
/**
* Provides additional theming for redesigned components.
* Used together with [TangemTheme].
* @param content Composable content where the theme is applied.
*/
@Composable
fun TangemThemeRedesign(content: @Composable () -> Unit) {
val themeColors = if (LocalIsInDarkTheme.current) darkThemeColors() else lightThemeColors(redesign = true)
val rememberedColors = remember { themeColors }
.also { it.update(themeColors) }
val rootBackgroundColor = rememberedColors.background.secondary
MaterialTheme(
colorScheme = tangemColorScheme(colors = themeColors),
) {
CompositionLocalProvider(
LocalTangemColors provides themeColors,
LocalTangemColors2 provides if (LocalIsInDarkTheme.current) darkThemeColors2() else lightThemeColors2(),
LocalTangemTypography provides TangemTypography(InterFamily),
LocalRootBackgroundColor provides remember(rootBackgroundColor) { mutableStateOf(rootBackgroundColor) },
) {
content()
}
}
}
@Composable
@ReadOnlyComposable
private fun lightThemeColors2(): TangemColors2 {
val text = TangemColors2.Text(
neutral = TangemColors2.Text.Neutral(
primary = TangemColorPalette.Dark6,
primaryInverted = TangemColorPalette.White,
secondary = TangemColorPalette.Dark2,
tertiary = TangemColorPalette.Dark3,
primaryInvertedConstant = TangemColorPalette.White,
),
status = TangemColors2.Text.Status(
disabled = TangemColorPalette.Light4,
accent = TangemColorPalette.Azure,
warning = TangemColorPalette.Amaranth,
attention = TangemColorPalette.Tangerine,
positive = TangemColorPalette.Green,
),
)
val graphic = TangemColors2.Graphic(
neutral = TangemColors2.Graphic.Neutral(
primary = TangemColorPalette.Dark6,
primaryInverted = TangemColorPalette.White,
secondary = TangemColorPalette.Dark2,
tertiary = TangemColorPalette.Dark3,
quaternary = TangemColorPalette.Light4,
primaryInvertedConstant = TangemColorPalette.White,
tertiaryConstant = TangemColorPalette.Dark3,
),
status = TangemColors2.Graphic.Status(
accent = TangemColorPalette.Azure,
warning = TangemColorPalette.Amaranth,
attention = TangemColorPalette.Tangerine,
),
)
val border = TangemColors2.Border(
neutral = TangemColors2.Border.Neutral(
primary = TangemColorPalette.Light3,
secondary = TangemColorPalette.Light5,
),
status = TangemColors2.Border.Status(
accent = TangemColorPalette.Azure,
warning = TangemColorPalette.Amaranth,
attention = TangemColorPalette.Tangerine,
),
)
val overlay = TangemColors2.Overlay(
overlayPrimary = TangemColorPalette.Overlay1,
overlaySecondary = TangemColorPalette.Overlay2,
)
val fill = TangemColors2.Fill(
neutral = TangemColors2.Fill.Neutral(
primary = TangemColorPalette.Dark6,
primaryInverted = TangemColorPalette.White,
primaryInvertedConstant = TangemColorPalette.White,
secondary = TangemColorPalette.Dark3,
tertiaryConstant = TangemColorPalette.Dark3,
quaternary = TangemColorPalette.Light4,
),
status = TangemColors2.Fill.Status(
accent = TangemColorPalette.Azure,
warning = TangemColorPalette.Amaranth,
attention = TangemColorPalette.Tangerine,
),
)
val button = TangemColors2.Button(
backgroundPrimary = TangemColorPalette.Dark6,
backgroundSecondary = TangemColorPalette.Dark6.copy(alpha = 0.1f),
backgroundDisabled = TangemColorPalette.Light3,
backgroundPositive = TangemColorPalette.Azure,
textSecondary = TangemColorPalette.Dark6,
textPrimary = TangemColorPalette.Light2,
textDisabled = text.neutral.tertiary,
iconPrimary = TangemColorPalette.Dark6,
iconSecondary = TangemColorPalette.Light1V2,
iconDisabled = TangemColorPalette.Light2,
borderPrimary = TangemColorPalette.Dark6,
)
val surface = TangemColors2.Surface(
level1 = TangemColorPalette.White,
level2 = TangemColorPalette.Light1V2,
level3 = TangemColorPalette.Light1V2,
level4 = TangemColorPalette.White,
)
val controls = TangemColors2.Controls(
backgroundChecked = TangemColorPalette.Dark6,
backgroundDefault = TangemColorPalette.Light2,
iconDefault = TangemColorPalette.White,
iconDisabled = TangemColorPalette.White,
)
val field = TangemColors2.Field(
backgroundDefault = TangemColorPalette.Light1V2,
backgroundFocused = TangemColorPalette.Light3,
textPlaceholder = text.neutral.secondary,
textDefault = text.neutral.primary,
textDisabled = text.neutral.tertiary,
iconDefault = graphic.neutral.tertiary,
iconDisabled = graphic.neutral.quaternary,
textInvalid = text.status.warning,
borderInvalid = border.status.warning,
)
val skeleton = TangemColors2.Skeleton(
backgroundPrimary = TangemColorPalette.Light1V2,
)
val markers = TangemColors2.Markers(
backgroundSolidGray = TangemColorPalette.Light3,
backgroundDisabled = TangemColorPalette.Light3,
backgroundSolidBlue = TangemColorPalette.Azure,
textGray = TangemColorPalette.Dark2,
textDisabled = text.neutral.tertiary,
iconGray = TangemColorPalette.Dark1,
iconDisabled = TangemColorPalette.Light2,
borderGray = TangemColorPalette.Light3,
backgroundTintedBlue = TangemColorPalette.Azure.copy(alpha = 0.1f),
textBlue = text.status.accent,
backgroundSolidRed = TangemColorPalette.Amaranth,
backgroundTintedRed = TangemColorPalette.Amaranth.copy(alpha = 0.1f),
iconBlue = TangemColorPalette.Azure,
iconRed = TangemColorPalette.Amaranth,
textRed = TangemColorPalette.Amaranth,
backgroundTintedGray = TangemColorPalette.Dark6.copy(alpha = 0.1f),
borderTintedBlue = TangemColorPalette.Azure.copy(alpha = 0.1f),
borderTintedRed = TangemColorPalette.Amaranth.copy(alpha = 0.1f),
)
return TangemColors2(
text = text,
graphic = graphic,
border = border,
overlay = overlay,
fill = fill,
button = button,
surface = surface,
controls = controls,
field = field,
skeleton = skeleton,
markers = markers,
)
}
@Composable
@ReadOnlyComposable
private fun darkThemeColors2(): TangemColors2 {
val text = TangemColors2.Text(
neutral = TangemColors2.Text.Neutral(
primary = TangemColorPalette.White,
primaryInverted = TangemColorPalette.Dark6,
secondary = TangemColorPalette.Light5,
tertiary = TangemColorPalette.Dark1,
primaryInvertedConstant = TangemColorPalette.White,
),
status = TangemColors2.Text.Status(
disabled = TangemColorPalette.Dark3,
accent = TangemColorPalette.Azure,
warning = TangemColorPalette.Flamingo,
attention = TangemColorPalette.Mustard,
positive = TangemColorPalette.Green,
),
)
val graphic = TangemColors2.Graphic(
neutral = TangemColors2.Graphic.Neutral(
primary = TangemColorPalette.White,
primaryInverted = TangemColorPalette.Dark6,
secondary = TangemColorPalette.Light5,
tertiary = TangemColorPalette.Dark3,
quaternary = TangemColorPalette.Dark3,
tertiaryConstant = TangemColorPalette.Dark3,
primaryInvertedConstant = TangemColorPalette.White,
),
status = TangemColors2.Graphic.Status(
accent = TangemColorPalette.Azure,
warning = TangemColorPalette.Flamingo,
attention = TangemColorPalette.Mustard,
),
)
val border = TangemColors2.Border(
neutral = TangemColors2.Border.Neutral(
primary = TangemColorPalette.Dark4,
secondary = TangemColorPalette.Dark4,
),
status = TangemColors2.Border.Status(
accent = TangemColorPalette.Azure,
warning = TangemColorPalette.Flamingo,
attention = TangemColorPalette.Mustard,
),
)
val overlay = TangemColors2.Overlay(
overlayPrimary = TangemColorPalette.Overlay1,
overlaySecondary = TangemColorPalette.Overlay2,
)
val fill = TangemColors2.Fill(
neutral = TangemColors2.Fill.Neutral(
primary = TangemColorPalette.White,
primaryInverted = TangemColorPalette.Dark6,
primaryInvertedConstant = TangemColorPalette.White,
secondary = TangemColorPalette.Light5,
tertiaryConstant = TangemColorPalette.Dark1,
quaternary = TangemColorPalette.Dark3,
),
status = TangemColors2.Fill.Status(
accent = TangemColorPalette.Azure,
warning = TangemColorPalette.Flamingo,
attention = TangemColorPalette.Mustard,
),
)
val button = TangemColors2.Button(
backgroundPrimary = TangemColorPalette.Light1V2,
backgroundSecondary = TangemColorPalette.White.copy(alpha = 0.1f),
backgroundDisabled = TangemColorPalette.Dark5,
backgroundPositive = TangemColorPalette.Azure,
textSecondary = TangemColorPalette.Light4,
textPrimary = TangemColorPalette.Dark4,
textDisabled = text.neutral.secondary,
iconPrimary = TangemColorPalette.Light4,
iconSecondary = TangemColorPalette.Dark4,
iconDisabled = TangemColorPalette.Dark5,
borderPrimary = TangemColorPalette.Light4,
)
val surface = TangemColors2.Surface(
level1 = TangemColorPalette.Dark6,
level2 = TangemColorPalette.Black,
level3 = TangemColorPalette.Dark6,
level4 = TangemColorPalette.Dark5,
)
val controls = TangemColors2.Controls(
backgroundChecked = TangemColorPalette.Azure,
backgroundDefault = TangemColorPalette.Dark4,
iconDefault = TangemColorPalette.White,
iconDisabled = TangemColorPalette.White,
)
val field = TangemColors2.Field(
backgroundDefault = TangemColorPalette.Dark6,
backgroundFocused = TangemColorPalette.Dark4,
textPlaceholder = text.neutral.secondary,
textDefault = text.neutral.primary,
textDisabled = text.neutral.tertiary,
iconDefault = graphic.neutral.tertiary,
iconDisabled = graphic.neutral.quaternary,
textInvalid = text.status.warning,
borderInvalid = border.status.warning,
)
val skeleton = TangemColors2.Skeleton(
backgroundPrimary = TangemColorPalette.Dark5,
)
val markers = TangemColors2.Markers(
backgroundSolidGray = TangemColorPalette.Dark5,
backgroundDisabled = TangemColorPalette.Dark5,
backgroundSolidBlue = TangemColorPalette.Azure,
textGray = TangemColorPalette.Light4,
textDisabled = text.neutral.secondary,
iconGray = TangemColorPalette.Dark2,
iconDisabled = TangemColorPalette.Dark5,
borderGray = TangemColorPalette.White.copy(alpha = 0.2f),
backgroundTintedBlue = TangemColorPalette.Azure.copy(alpha = 0.1f),
textBlue = text.status.accent,
backgroundSolidRed = TangemColorPalette.Amaranth,
backgroundTintedRed = TangemColorPalette.Amaranth.copy(alpha = 0.1f),
iconBlue = TangemColorPalette.Azure,
iconRed = TangemColorPalette.Flamingo,
textRed = TangemColorPalette.Flamingo,
backgroundTintedGray = TangemColorPalette.White.copy(alpha = 0.1f),
borderTintedBlue = TangemColorPalette.Azure.copy(alpha = 0.1f),
borderTintedRed = TangemColorPalette.Amaranth.copy(alpha = 0.1f),
)
return TangemColors2(
text = text,
graphic = graphic,
border = border,
overlay = overlay,
fill = fill,
button = button,
surface = surface,
controls = controls,
field = field,
skeleton = skeleton,
markers = markers,
)
}

View file

@ -4,6 +4,7 @@ import androidx.compose.runtime.Immutable
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.LineHeightStyle
import androidx.compose.ui.unit.TextUnit
@ -11,15 +12,22 @@ import androidx.compose.ui.unit.TextUnitType
import androidx.compose.ui.unit.sp
import com.tangem.core.ui.R
private val RobotoFamily = FontFamily(
internal val RobotoFamily = FontFamily(
Font(R.font.roboto_regular, FontWeight.Normal),
Font(R.font.roboto_medium, FontWeight.Medium),
)
internal val InterFamily = FontFamily(
Font(R.font.inter_regular),
Font(R.font.inter_italic, style = FontStyle.Italic),
)
@Immutable
data class TangemTypography internal constructor(
class TangemTypography internal constructor(
fontFamily: FontFamily,
) {
val head: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 34.sp,
fontWeight = FontWeight.SemiBold,
letterSpacing = TextUnit(value = 0f, type = TextUnitType.Sp),
@ -28,9 +36,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val h1: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 34.sp,
fontWeight = FontWeight.Normal,
letterSpacing = TextUnit(value = 0f, type = TextUnitType.Sp),
@ -39,9 +47,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val h2: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 24.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.18f, type = TextUnitType.Sp),
@ -50,9 +58,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val h3: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 20.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.15f, type = TextUnitType.Sp),
@ -61,9 +69,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val subtitle1: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 16.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.15f, type = TextUnitType.Sp),
@ -72,9 +80,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val subtitle2: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.1f, type = TextUnitType.Sp),
@ -83,9 +91,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val body1: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 16.sp,
fontWeight = FontWeight.Normal,
letterSpacing = TextUnit(value = 0.5f, type = TextUnitType.Sp),
@ -94,9 +102,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val body2: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 14.sp,
fontWeight = FontWeight.Normal,
letterSpacing = TextUnit(value = 0.25f, type = TextUnitType.Sp),
@ -105,9 +113,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val button: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.1f, type = TextUnitType.Sp),
@ -116,9 +124,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val caption1: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 12.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 0.4f, type = TextUnitType.Sp),
@ -127,9 +135,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val caption2: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 12.sp,
fontWeight = FontWeight.Normal,
letterSpacing = TextUnit(value = 0.4f, type = TextUnitType.Sp),
@ -138,9 +146,9 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
val overline: TextStyle = TextStyle(
fontFamily = RobotoFamily,
fontFamily = fontFamily,
fontSize = 10.sp,
fontWeight = FontWeight.Medium,
letterSpacing = TextUnit(value = 1.5f, type = TextUnitType.Sp),
@ -149,5 +157,5 @@ data class TangemTypography internal constructor(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None,
),
),
)
)
}

Binary file not shown.

Binary file not shown.