🚀 Add new Default Color Preset colors

Changed new Color Preset's colors to match current theme by default. The default Color Preset's colors are replaced to match Light Blue theme.

Resolves: #53
This commit is contained in:
Acclorite 2024-08-23 21:38:45 +03:00
parent e1fdac0f39
commit 5eba85309b
7 changed files with 18 additions and 8 deletions

View file

@ -541,7 +541,7 @@ private fun provideEmptyBook() = Book(
private fun provideDefaultColorPreset() = ColorPreset(
id = -1,
name = null,
backgroundColor = Color.DarkGray,
fontColor = Color.LightGray,
backgroundColor = Color(0xFFFAF8FF), // Blue Light Surface (hardcoded)
fontColor = Color(0xFF44464F), // Blue Light OnSurfaceVariant (hardcoded)
isSelected = false
)

View file

@ -66,7 +66,7 @@ fun ReaderEndItem(
Column(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colorScheme.surface)
.background(MaterialTheme.colorScheme.surfaceContainerLowest)
.padding(
horizontal = 36.dp,
vertical = 108.dp + WindowInsets.navigationBarsIgnoringVisibility

View file

@ -55,7 +55,7 @@ fun ReaderStartItem(state: State<ReaderState>) {
Box(
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.surface)
.background(MaterialTheme.colorScheme.surfaceContainerLowest)
) {
if (state.value.book.coverImage != null) {
ReaderStartItemBackground(

View file

@ -19,7 +19,7 @@ import ua.acclorite.book_story.presentation.components.CustomCoverImage
*/
@Composable
fun ReaderStartItemBackground(height: Dp, image: Uri) {
val background = MaterialTheme.colorScheme.surface
val background = MaterialTheme.colorScheme.surfaceContainerLowest
CustomCoverImage(
uri = image,

View file

@ -38,7 +38,7 @@ sealed class SettingsEvent {
val fontColor: Color?
) : SettingsEvent()
data object OnAddColorPreset : SettingsEvent()
data class OnAddColorPreset(val backgroundColor: Color, val fontColor: Color) : SettingsEvent()
data class OnReorderColorPresets(val from: Int, val to: Int) : SettingsEvent()
data object OnConfirmReorderColorPresets : SettingsEvent()
}

View file

@ -394,7 +394,10 @@ class SettingsViewModel @Inject constructor(
addColorPresetJob = launch {
yield()
val newColorPreset = Constants.DEFAULT_COLOR_PRESET
val newColorPreset = Constants.DEFAULT_COLOR_PRESET.copy(
backgroundColor = event.backgroundColor,
fontColor = event.fontColor
)
updateColorPreset.execute(newColorPreset)
onSelectColorPreset(getColorPresets.execute().last())

View file

@ -90,6 +90,8 @@ fun LazyItemScope.ColorPresetSetting(
) { from, to ->
onEvent(SettingsEvent.OnReorderColorPresets(from.index, to.index))
}
val defaultBackgroundColor = MaterialTheme.colorScheme.surface
val defaultFontColor = MaterialTheme.colorScheme.onSurfaceVariant
Column(
Modifier
@ -200,7 +202,12 @@ fun LazyItemScope.ColorPresetSetting(
)
},
onAdd = {
onEvent(SettingsEvent.OnAddColorPreset)
onEvent(
SettingsEvent.OnAddColorPreset(
backgroundColor = defaultBackgroundColor,
fontColor = defaultFontColor
)
)
}
)