TeamAmaze / TeamAmaze/AmazeFileManager

Remove ThemedTextView and set the text color based on background color luma

Open
#2,681 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-UIUX Issue-Bug Issue-Easy (good first issue)
Dominant language
Kotlin
Stars
6.4k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
1

Description

  /**
   * Correctly sets text color based on a given background color so that the
   * user can see the text correctly
   */
  @JvmStatic
  fun setIntelligentTextColor(context: Context, textView: TextView, backgroundColor: Int) {
    val red = Color.red(backgroundColor) * 0.299f
    val green = Color.green(backgroundColor) * 0.587f
    val blue = Color.blue(backgroundColor) * 0.114f

    val luma = (red + green + blue) / 255.0f

    val color = if(luma > 0.5) android.R.color.black else android.R.color.white

    textView.setTextColor(Utils.getColor(context, color))
  }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the Kotlin Android sources for ThemedTextView and setIntelligentTextColor, then inspect every usage and any related color tests. The work is done when ThemedTextView is removed, text colors use the background-luma behavior described here, and the relevant Android tests or build pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.