MCPcopy Create free account
hub / github.com/adobe/react-spectrum / setHue

Function setHue

packages/react-stately/src/color/useColorWheelState.ts:155–165  ·  view source on GitHub ↗
(v: number)

Source from the content-addressed store, hash-verified

153
154 let hue = value.getChannelValue('hue');
155 function setHue(v: number) {
156 if (v > 360) {
157 // Make sure you can always get back to 0.
158 v = 0;
159 }
160 v = roundToStep(mod(v, 360), step);
161 if (hue !== v) {
162 let color = value.withChannelValue('hue', v);
163 setValue(color);
164 }
165 }
166
167 return {
168 value,

Callers 3

setHueFromPointFunction · 0.85
incrementFunction · 0.85
decrementFunction · 0.85

Calls 4

roundToStepFunction · 0.85
withChannelValueMethod · 0.80
modFunction · 0.70
setValueFunction · 0.70

Tested by

no test coverage detected