From 3d532c07dd047999f870cbd8bc4d9fec3fdae4cf Mon Sep 17 00:00:00 2001 From: LeanBitLab Date: Mon, 16 Nov 2026 18:47:50 +0530 Subject: [PATCH] fix(clipboard): keep action pill icons visible on mid-tone themes The pill was filled white unless the theme background was near-black (isDarkColor threshold), while its icons use KEY_ICON. A mid-tone theme with light icons got white icons on a white pill. Use the toolbar background whenever the icon color is light. --- .../keyboard/keyboard/clipboard/ClipboardHistoryView.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt b/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt index 78c46382e..dc41825ff 100644 --- a/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt +++ b/app/src/main/java/helium314/keyboard/keyboard/clipboard/ClipboardHistoryView.kt @@ -926,7 +926,9 @@ class ClipboardHistoryView @JvmOverloads constructor( val mainBg = colors.get(ColorType.MAIN_BACKGROUND) val isDark = isDarkColor(mainBg) || isDarkColor(cardBg) - val pillFillColor = if (isDark) { + // isDarkColor is only true for near-black colors, so a mid-tone theme with light icons must not get a white pill + val iconsAreLight = ColorUtils.calculateLuminance(colors.get(ColorType.KEY_ICON)) > 0.5 + val pillFillColor = if (isDark || iconsAreLight) { colors.get(ColorType.TOOL_BAR_EXPAND_KEY_BACKGROUND) } else { Color.WHITE