qalculate-android icon indicating copy to clipboard operation
qalculate-android copied to clipboard

Select foreground colours based on background colours to ensure readability

Open squ1dd13 opened this issue 6 months ago • 1 comments

Thanks for this app, I love qalc and having it on Android is great :)

The colours for text in the main calculator interface are now chosen by calling androidx.compose.material3.contentColorFor with the background colour so that the contrast between the content and background is always good, even with dynamic colours. This fixes #75 insofar as maintaining readability, although it does not provide any settings for manually choosing the colours. However, as contentColorFor selects the appropriate foreground colour from the colour scheme and the app uses background colours from the same scheme, there should never be a situation where the user would need to change the colours manually in order to read the text.

Along the way I got a bit distracted and made a couple of other minor adjustments to bring things more into accordance with the Material guidelines on both the calculator and units screens.

On the left is the previous interface, and on the right is the one in this PR, both in the Pixel 5 emulator on Android 11:

And on my Pixel 9 on Android 15:

In dark mode:

The units screen:

squ1dd13 avatar Jun 12 '25 10:06 squ1dd13

Hi squ1dd13. Thanks a lot for your work and sorry for my very late reply. I am currently re-thinking the UI of the Qalculate app, which is why I have not yet pulled your changes into main. I did not know about contentColorFor and will definately continue to use it. Once I know the roadmap for the UI overhaul, I will rebase off your PR

jherkenhoff avatar Jul 31 '25 12:07 jherkenhoff