2.0.0 • Published 2 years ago

mixbox v2.0.0

Weekly downloads
-
License
CC-BY-NC-4.0
Repository
github
Last release
2 years ago

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

PigmentRGBFloat RGBLinear RGB
Cadmium Yellow254, 236, 00.996, 0.925, 0.00.991, 0.839, 0.0
Hansa Yellow252, 211, 00.988, 0.827, 0.00.973, 0.651, 0.0
Cadmium Orange255, 105, 01.0, 0.412, 0.01.0, 0.141, 0.0
Cadmium Red255, 39, 21.0, 0.153, 0.0081.0, 0.02, 0.001
Quinacridone Magenta128, 2, 460.502, 0.008, 0.180.216, 0.001, 0.027
Cobalt Violet78, 0, 660.306, 0.0, 0.2590.076, 0.0, 0.054
Ultramarine Blue25, 0, 890.098, 0.0, 0.3490.01, 0.0, 0.1
Cobalt Blue0, 33, 1330.0, 0.129, 0.5220.0, 0.015, 0.235
Phthalo Blue13, 27, 680.051, 0.106, 0.2670.004, 0.011, 0.058
Phthalo Green0, 60, 500.0, 0.235, 0.1960.0, 0.045, 0.032
Permanent Green7, 109, 220.027, 0.427, 0.0860.002, 0.153, 0.008
Sap Green107, 148, 40.42, 0.58, 0.0160.147, 0.296, 0.001
Burnt Sienna123, 72, 00.482, 0.282, 0.00.198, 0.065, 0.0

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

0.0.1-dev11

2 years ago

0.0.1-dev6

2 years ago

0.0.1-dev10

2 years ago

0.0.1-dev5

2 years ago

0.0.1-dev8

2 years ago

0.0.1-dev12

2 years ago

0.0.1-dev7

2 years ago

0.0.1-dev9

2 years ago

0.0.1-dev20

2 years ago

0.0.1-dev19

2 years ago

0.0.1-dev18

2 years ago

0.0.1-dev15

2 years ago

0.0.1-dev14

2 years ago

0.0.1-dev17

2 years ago

0.0.1-dev16

2 years ago

2.0.0

2 years ago

0.0.1-dev4

3 years ago

0.0.1-dev3

3 years ago

0.0.1-dev2

3 years ago

0.0.1

3 years ago