Skip to content

fix(whiteboard): keep the chosen hue visible when the brush is dark#21333

Open
criticalAY wants to merge 1 commit into
ankidroid:mainfrom
criticalAY:fix/color-issue
Open

fix(whiteboard): keep the chosen hue visible when the brush is dark#21333
criticalAY wants to merge 1 commit into
ankidroid:mainfrom
criticalAY:fix/color-issue

Conversation

@criticalAY

Copy link
Copy Markdown
Contributor

Purpose / Description

The whiteboard color picker ignores the color you choose when the current brush is dark: you tap a color on the wheel, press OK, and the brush stays black (or comes back near-black). This makes it impossible to add a custom brush color starting from the default black brush.

The cause is how the picker is built. The wheel only controls hue and saturation; brightness is a separate slider below it. When the picker opens on a dark color, that slider is parked near zero, and the final color is assembled from the slider's
brightness. So no matter where you tap on the wheel, the result assembles back to near-black and the picker looks broken.

Fixes

Approach

On the first touch of the wheel, if the current color's brightness is near zero (the slider is parked there), snap the brightness slider to full before the tap is handled. This covers pure black and dark non-black seeds like #030000, without affecting normal picking.

How Has This Been Tested?

Pixel 10 and added Robolectric unit tests in ColorPickerDialogTest

Screen_recording_20260702_182437.mp4

Learning (optional, can help others)

Describe the research stage

Links to blog posts, patterns, libraries or addons used to solve this problem

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

The color wheel only sets hue and saturation. Brightness comes from the
slider below it, and a dark brush parks that slider near zero, so every
color picked on the wheel assembled back to near black and the picker
looked like it ignored the selection.

Restore full brightness the moment the user starts picking a hue from a
near-black color, so the color they tap is the color they get.
Comment on lines +122 to +127
setOnTouchListener { _, event ->
if (event.actionMasked == MotionEvent.ACTION_DOWN && color.isNearBlack()) {
brightnessSlider?.setSelectorByHalfSelectorPosition(1f)
}
false
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the touch listener? I believe that the issue only matters for the initial state of the color picker. That state depends on the initialColor that is set above, so configuring the brightness once should be enough.

Or maybe we should always use the same initialColor, with something as White (center position in the color wheel and 100% brightness)

@BrayanDSO BrayanDSO added the Needs Author Reply Waiting for a reply from the original author label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Author Reply Waiting for a reply from the original author Needs Review Priority-Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to select custom brush color for whiteboard

2 participants