Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Background colour not fixed when hue is 0 #186

Closed
ghelyar opened this issue Nov 14, 2016 · 1 comment
Closed

Background colour not fixed when hue is 0 #186

ghelyar opened this issue Nov 14, 2016 · 1 comment

Comments

@ghelyar
Copy link

ghelyar commented Nov 14, 2016

When the initial hue is 0 (e.g. colour is black or red), the background colour of the saturation bar changes as the saturation is changed. When the hue is not 0 (e.g. colour is blue or #ff0001), the background colour is fixed.

The fixed background colour seems to be the correct behaviour, as this means that the user can see what the colour will be before they click on it. The background colour should probably only ever change as the hue bar changes and default to red.

Manually dragging to the top of the hue bar also fixes the background colour.

This fiddle demonstrates the issue:
https://jsfiddle.net/34v1kjkc/

Edit: this may be a duplicate of #183 but I couldn't be sure from that bug's description ("this happens")

@ghelyar
Copy link
Author

ghelyar commented Nov 14, 2016

The bug seems to be in Color.toRGB, where !h returns true for both undefined and 0.

A possible fix is to change
if (!h) { ... }
to
if (typeof h === "undefined") { ... }

However, I don't know what other implications doing this has.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant