Allow high-contrast input colors to be used as-is #3209
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For step 9 of the color scale, we try to respect the user's chosen color, unless it really isn't accessible. We use a lightness check and if the color is within 20% of the target lightness, we allow it to be used even if it doesn't exactly match.
This PR changes the logic of this check slightly to no longer restrict the lower and higher contrast bounds, but only the lower bound. In practice, it means that if you have a color that is higher contrast than needed, it will now be used as-is instead of being reduced to a less-contrasting version.
This is particularly useful if you set the primary color to black on light mode, or white on dark mode. Before this would result in a grey color being used for your buttons, but now you can get exact blacks or whites since they are more contrasting anyway.
Before
After