fix: Icon menu color

This commit is contained in:
J-Jamet committed 2026-06-24 11:17:56 +02:00
1 parent 78a7fc6335
commit 6daec3cab5
1 file changed
+20 -14
@@ -127,10 +127,12 @@ class EntryViewModel(application: Application): AndroidViewModel(application) {
_entryEvents.emit(EntryEvent.EntryLoaded(entryInfo))
// Assign colors
backgroundColor =
val background =
if (showEntryColors) entryInfo.backgroundColor else null
foregroundColor =
val foreground =
if (showEntryColors) entryInfo.foregroundColor else null
backgroundColor = background
foregroundColor = foreground
// To show Entry UI
_entryUIState.update {
@@ -142,7 +144,13 @@ class EntryViewModel(application: Application): AndroidViewModel(application) {
showHistoryView = isHistory,
entryHistory = if (!isHistory)
database.getHistoryEntryInfoFrom(mainEntryId) ?: listOf()
else listOf()
else listOf(),
toolbarColor = background ?: colorSurface,
onToolbarColor = foreground ?: colorOnSurface,
iconColor = foreground ?: colorSecondary,
iconBackgroundColor = background?.let { bg ->
ColorUtils.blendARGB(bg, Color.WHITE, 0.1f)
} ?: colorBackground
)
}
@@ -220,17 +228,15 @@ class EntryViewModel(application: Application): AndroidViewModel(application) {
}
fun applyToolbarColors() {
viewModelScope.launch {
_entryUIState.update {
it.copy(
toolbarColor = backgroundColor ?: colorSurface,
onToolbarColor = foregroundColor ?: colorOnSurface,
iconColor = foregroundColor ?: colorSecondary,
iconBackgroundColor = backgroundColor?.let { background ->
ColorUtils.blendARGB(background, Color.WHITE, 0.1f)
} ?: colorBackground
)
}
_entryUIState.update {
it.copy(
toolbarColor = backgroundColor ?: colorSurface,
onToolbarColor = foregroundColor ?: colorOnSurface,
iconColor = foregroundColor ?: colorSecondary,
iconBackgroundColor = backgroundColor?.let { background ->
ColorUtils.blendARGB(background, Color.WHITE, 0.1f)
} ?: colorBackground
)
}
}