🚀 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:
parent
e1fdac0f39
commit
5eba85309b
7 changed files with 18 additions and 8 deletions
|
|
@ -541,7 +541,7 @@ private fun provideEmptyBook() = Book(
|
||||||
private fun provideDefaultColorPreset() = ColorPreset(
|
private fun provideDefaultColorPreset() = ColorPreset(
|
||||||
id = -1,
|
id = -1,
|
||||||
name = null,
|
name = null,
|
||||||
backgroundColor = Color.DarkGray,
|
backgroundColor = Color(0xFFFAF8FF), // Blue Light Surface (hardcoded)
|
||||||
fontColor = Color.LightGray,
|
fontColor = Color(0xFF44464F), // Blue Light OnSurfaceVariant (hardcoded)
|
||||||
isSelected = false
|
isSelected = false
|
||||||
)
|
)
|
||||||
|
|
@ -66,7 +66,7 @@ fun ReaderEndItem(
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
.background(MaterialTheme.colorScheme.surfaceContainerLowest)
|
||||||
.padding(
|
.padding(
|
||||||
horizontal = 36.dp,
|
horizontal = 36.dp,
|
||||||
vertical = 108.dp + WindowInsets.navigationBarsIgnoringVisibility
|
vertical = 108.dp + WindowInsets.navigationBarsIgnoringVisibility
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ fun ReaderStartItem(state: State<ReaderState>) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(MaterialTheme.colorScheme.surface)
|
.background(MaterialTheme.colorScheme.surfaceContainerLowest)
|
||||||
) {
|
) {
|
||||||
if (state.value.book.coverImage != null) {
|
if (state.value.book.coverImage != null) {
|
||||||
ReaderStartItemBackground(
|
ReaderStartItemBackground(
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import ua.acclorite.book_story.presentation.components.CustomCoverImage
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun ReaderStartItemBackground(height: Dp, image: Uri) {
|
fun ReaderStartItemBackground(height: Dp, image: Uri) {
|
||||||
val background = MaterialTheme.colorScheme.surface
|
val background = MaterialTheme.colorScheme.surfaceContainerLowest
|
||||||
|
|
||||||
CustomCoverImage(
|
CustomCoverImage(
|
||||||
uri = image,
|
uri = image,
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ sealed class SettingsEvent {
|
||||||
val fontColor: Color?
|
val fontColor: Color?
|
||||||
) : SettingsEvent()
|
) : 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 class OnReorderColorPresets(val from: Int, val to: Int) : SettingsEvent()
|
||||||
data object OnConfirmReorderColorPresets : SettingsEvent()
|
data object OnConfirmReorderColorPresets : SettingsEvent()
|
||||||
}
|
}
|
||||||
|
|
@ -394,7 +394,10 @@ class SettingsViewModel @Inject constructor(
|
||||||
addColorPresetJob = launch {
|
addColorPresetJob = launch {
|
||||||
yield()
|
yield()
|
||||||
|
|
||||||
val newColorPreset = Constants.DEFAULT_COLOR_PRESET
|
val newColorPreset = Constants.DEFAULT_COLOR_PRESET.copy(
|
||||||
|
backgroundColor = event.backgroundColor,
|
||||||
|
fontColor = event.fontColor
|
||||||
|
)
|
||||||
updateColorPreset.execute(newColorPreset)
|
updateColorPreset.execute(newColorPreset)
|
||||||
|
|
||||||
onSelectColorPreset(getColorPresets.execute().last())
|
onSelectColorPreset(getColorPresets.execute().last())
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,8 @@ fun LazyItemScope.ColorPresetSetting(
|
||||||
) { from, to ->
|
) { from, to ->
|
||||||
onEvent(SettingsEvent.OnReorderColorPresets(from.index, to.index))
|
onEvent(SettingsEvent.OnReorderColorPresets(from.index, to.index))
|
||||||
}
|
}
|
||||||
|
val defaultBackgroundColor = MaterialTheme.colorScheme.surface
|
||||||
|
val defaultFontColor = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
Modifier
|
Modifier
|
||||||
|
|
@ -200,7 +202,12 @@ fun LazyItemScope.ColorPresetSetting(
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onAdd = {
|
onAdd = {
|
||||||
onEvent(SettingsEvent.OnAddColorPreset)
|
onEvent(
|
||||||
|
SettingsEvent.OnAddColorPreset(
|
||||||
|
backgroundColor = defaultBackgroundColor,
|
||||||
|
fontColor = defaultFontColor
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue