@pbroom/color-kit/driverMulti color
setMultiColorRequested
Replaces an entry's requested color. An achromatic requested keeps the entry's current hue when options.explicitHue is false or its hue is not finite (see resolveIncomingRequested). The entry's source is set to source. Returns model unchanged for an unknown id; otherwise always a new model, even when nothing changed.
import { setMultiColorRequested } from '@pbroom/color-kit/driver';multi-color-state.ts:372function setMultiColorRequested(
model: MultiColorModel,
id: string,
incoming: Color,
source: ColorSource,
options?: SetMultiColorRequestedOptions,
): MultiColorModel;Parameters
- id
string - options?
SetMultiColorRequestedOptionsdefault{}
Returns
Example
import { parse, toHex } from '@pbroom/color-kit';
import {
createMultiColorModel,
setMultiColorRequested,
} from '@pbroom/color-kit/driver';
const model = createMultiColorModel({ colors: { bg: '#ffffff', fg: '#3b82f6' } });
const next = setMultiColorRequested(model, 'fg', parse('#808080'), 'user', {
explicitHue: false,
});
toHex(next.entries.fg.requested); // → '#808080'
next.entries.fg.requested.h === model.entries.fg.requested.h; // → true