Initial commit
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
package it.vfsfitvnm.vimusic.ui.styling
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
@Immutable
|
||||
data class ColorPalette(
|
||||
val background: Color,
|
||||
val elevatedBackground: Color,
|
||||
val lightBackground: Color,
|
||||
val text: Color,
|
||||
val textSecondary: Color,
|
||||
val textDisabled: Color,
|
||||
val lightGray: Color,
|
||||
val gray: Color,
|
||||
val darkGray: Color,
|
||||
val blue: Color,
|
||||
val red: Color,
|
||||
val green: Color,
|
||||
val orange: Color,
|
||||
|
||||
val primaryContainer: Color,
|
||||
val onPrimaryContainer: Color,
|
||||
val iconOnPrimaryContainer: Color,
|
||||
)
|
||||
|
||||
val DarkColorPalette = ColorPalette(
|
||||
background = Color(0xff16171d),
|
||||
lightBackground = Color(0xff1f2029),
|
||||
elevatedBackground = Color(0xff1f2029),
|
||||
text = Color(0xffe1e1e2),
|
||||
textSecondary = Color(0xffa3a4a6),
|
||||
textDisabled = Color(0xff6f6f73),
|
||||
lightGray = Color(0xfff8f8f8),
|
||||
gray = Color(0xFFE5E5E5),
|
||||
darkGray = Color(0xFF838383),
|
||||
blue = Color(0xff4046bf),
|
||||
red = Color(0xffbf4040),
|
||||
green = Color(0xff7fbf40),
|
||||
orange = Color(0xffe8820e),
|
||||
|
||||
primaryContainer = Color(0xff4046bf),
|
||||
onPrimaryContainer = Color.White,
|
||||
iconOnPrimaryContainer = Color.White,
|
||||
)
|
||||
|
||||
val LightColorPalette = ColorPalette(
|
||||
background = Color(0xfffdfdfe),
|
||||
lightBackground = Color(0xFFf8f8fc),
|
||||
elevatedBackground = Color(0xfffdfdfe),
|
||||
lightGray = Color(0xfff8f8f8),
|
||||
gray = Color(0xFFE5E5E5),
|
||||
darkGray = Color(0xFF838383),
|
||||
text = Color(0xff212121),
|
||||
textSecondary = Color(0xFF656566),
|
||||
textDisabled = Color(0xFF9d9d9d),
|
||||
blue = Color(0xff4059bf),
|
||||
red = Color(0xffbf4040),
|
||||
green = Color(0xff7fbf40),
|
||||
orange = Color(0xffe8730e),
|
||||
|
||||
primaryContainer = Color(0xff4046bf),
|
||||
onPrimaryContainer = Color.White,
|
||||
iconOnPrimaryContainer = Color.White,
|
||||
// primaryContainer = Color(0xffecedf9),
|
||||
// onPrimaryContainer = Color(0xff121212),
|
||||
// iconOnPrimaryContainer = Color(0xff2e30b8),
|
||||
)
|
||||
|
||||
val LocalColorPalette = staticCompositionLocalOf { LightColorPalette }
|
||||
|
||||
@Composable
|
||||
fun rememberColorPalette(isDarkTheme: Boolean = isSystemInDarkTheme()): ColorPalette {
|
||||
return remember(isDarkTheme) {
|
||||
if (isDarkTheme) DarkColorPalette else LightColorPalette
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package it.vfsfitvnm.vimusic.ui.styling
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.staticCompositionLocalOf
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.ExperimentalTextApi
|
||||
import androidx.compose.ui.text.PlatformTextStyle
|
||||
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.unit.sp
|
||||
import it.vfsfitvnm.vimusic.R
|
||||
|
||||
@Immutable
|
||||
data class Typography(
|
||||
val xxs: TextStyle,
|
||||
val xs: TextStyle,
|
||||
val s: TextStyle,
|
||||
val m: TextStyle,
|
||||
val l: TextStyle,
|
||||
)
|
||||
|
||||
val LocalTypography = staticCompositionLocalOf<Typography> { TODO() }
|
||||
|
||||
@ExperimentalTextApi
|
||||
@Composable
|
||||
fun rememberTypography(color: Color): Typography {
|
||||
return remember(color) {
|
||||
TextStyle(
|
||||
fontFamily = FontFamily(
|
||||
Font(
|
||||
resId = R.font.poppins_w300,
|
||||
weight = FontWeight.Light
|
||||
),
|
||||
Font(
|
||||
resId = R.font.poppins_w400,
|
||||
weight = FontWeight.Normal
|
||||
),
|
||||
Font(
|
||||
resId = R.font.poppins_w400_italic,
|
||||
weight = FontWeight.Normal,
|
||||
style = FontStyle.Italic
|
||||
),
|
||||
Font(
|
||||
resId = R.font.poppins_w500,
|
||||
weight = FontWeight.Medium
|
||||
),
|
||||
Font(
|
||||
resId = R.font.poppins_w600,
|
||||
weight = FontWeight.SemiBold
|
||||
),
|
||||
Font(
|
||||
resId = R.font.poppins_w700,
|
||||
weight = FontWeight.Bold
|
||||
),
|
||||
),
|
||||
fontWeight = FontWeight.Normal,
|
||||
color = color,
|
||||
platformStyle = PlatformTextStyle(includeFontPadding = false)
|
||||
).run {
|
||||
Typography(
|
||||
xxs = copy(fontSize = 12.sp),
|
||||
xs = copy(fontSize = 14.sp),
|
||||
s = copy(fontSize = 16.sp),
|
||||
m = copy(fontSize = 18.sp),
|
||||
l = copy(fontSize = 20.sp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user