Mixbox: Pigment-Based Color Mixing
Usage
import mixbox from 'mixbox';
let rgb1 = "rgb(0, 33, 133)"; // blue
let rgb2 = "rgb(252, 211, 0)"; // yellow
let t = 0.5; // mixing ratio
let mixed = mixbox.lerp(rgb1, rgb2, t);
console.log(mixed);
Mixing Multiple Colors
let z1 = mixbox.rgbToLatent(rgb1);
let z2 = mixbox.rgbToLatent(rgb2);
let z3 = mixbox.rgbToLatent(rgb3);
let zMix = new Array(mixbox.LATENT_SIZE);
for (let i = 0; i < zMix.length; i++) { // mix:
zMix[i] = (0.3*z1[i] + // 30% of rgb1
0.6*z2[i] + // 60% of rgb2
0.1*z3[i]); // 10% of rgb3
}
let rgbMix = mixbox.latentToRgb(zMix);
Pigment Colors
License
Copyright (c) 2022, Secret Weapons. All rights reserved.
Mixbox is provided under the CC BY-NC 4.0 license for non-commercial use only.
If you want to obtain commercial license, please contact: mixbox@scrtwpns.com