feat: First appearance version (#281)

Co-authored-by: TEYSSANDIER Raphael <rteyssandier@sephora.fr>
This commit is contained in:
Raphael Teyssandier 2025-10-01 10:32:57 +02:00 committed by GitHub
parent c2887551d2
commit 5c8c4e0d95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 272 additions and 59 deletions

View file

@ -29,6 +29,7 @@ import io.github.openflocon.library.designsystem.theme.darkPalette
import io.github.openflocon.library.designsystem.theme.lightPalette
import io.github.openflocon.library.designsystem.theme.materialDarkScheme
import io.github.openflocon.library.designsystem.theme.materialLightScheme
import io.github.openflocon.library.designsystem.theme.multiplyFontSizeBy
object FloconTheme {
@ -45,6 +46,7 @@ object FloconTheme {
@Composable
fun FloconTheme(
fontSizeMultiplier: Float = 1f,
isDarkTheme: Boolean = isSystemInDarkTheme(), // TODO Add setting and override
content: @Composable () -> Unit
) {
@ -78,7 +80,7 @@ fun FloconTheme(
)
MaterialTheme(
typography = typography,
typography = typography.multiplyFontSizeBy(fontSizeMultiplier),
colorScheme = if (isDarkTheme) {
materialDarkScheme(colorPalette)
} else {

View file

@ -0,0 +1,28 @@
package io.github.openflocon.library.designsystem.components
import androidx.compose.material3.Slider
import androidx.compose.material3.SliderDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import io.github.openflocon.library.designsystem.FloconTheme
@Composable
fun FloconSlider(
value: Float,
onValueChange: (Float) -> Unit,
modifier: Modifier = Modifier,
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
steps: Int = 0
) {
Slider(
value = value,
onValueChange = onValueChange,
steps = steps,
valueRange = valueRange,
colors = SliderDefaults.colors(
activeTrackColor = FloconTheme.colorPalette.secondary,
thumbColor = FloconTheme.colorPalette.onSecondary
),
modifier = modifier
)
}

View file

@ -0,0 +1,31 @@
package io.github.openflocon.library.designsystem.theme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Typography
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.TextStyle
@Composable
fun Typography.multiplyFontSizeBy(multiplier: Float): Typography {
return copy(
displayLarge = displayLarge.multiply(multiplier),
displaySmall = displaySmall.multiply(multiplier),
displayMedium = displayMedium.multiply(multiplier),
headlineLarge = headlineLarge.multiply(multiplier),
headlineMedium = headlineMedium.multiply(multiplier),
headlineSmall = headlineSmall.multiply(multiplier),
titleLarge = titleLarge.multiply(multiplier),
titleMedium = titleMedium.multiply(multiplier),
titleSmall = titleSmall.multiply(multiplier),
bodyLarge = bodyLarge.multiply(multiplier),
bodyMedium = bodyMedium.multiply(multiplier),
bodySmall = bodySmall.multiply(multiplier),
labelLarge = labelLarge.multiply(multiplier),
labelMedium = labelMedium.multiply(multiplier),
labelSmall = labelSmall.multiply(multiplier)
)
}
private fun TextStyle.multiply(multiplier: Float): TextStyle {
return copy(fontSize = fontSize * multiplier)
}