Recipe Builder
Click a swatch to add it to the recipe. Clicking it again increases its parts, and you can also add your own colors below.
Instead of mixing in plain RGB, SpectralNN Paint Mixer starts from a subtractive physical baseline and uses a neural network only to correct the remaining residual errors. The demo below lets you inspect both outputs from the same recipe.
Click a swatch to add it to the recipe. Clicking it again increases its parts, and you can also add your own colors below.
Start with a simple two-color recipe to inspect both runtime paths.
Physical base model plus neural residual correction.
#FFFFFF
The same recipe before neural correction is applied.
#FFFFFF
Both panels are computed from the exact same recipe, so the difference you see is the residual model alone.
Use It
The runtime API stays intentionally small: colors, integer parts, and a mixer entry point. Switch languages below to see the same recipe shape in both runtimes.
Install
npm install @rtarik/spectralnn-paint-mixer
Mix
import { MixPortion, PaintMixers, SrgbColor } from '@rtarik/spectralnn-paint-mixer';
const mixer = PaintMixers.default();
const result = mixer.mixOrNull([
new MixPortion({ color: SrgbColor.fromHex('#E53935'), parts: 1 }),
new MixPortion({ color: SrgbColor.fromHex('#283593'), parts: 1 }),
]);
console.log(result?.toHexString());
Install
implementation("io.github.rtarik:spectralnn-paint-mixer-kotlin:0.1.0-alpha.1")
Mix
import io.github.rtarik.paintmixer.MixPortion
import io.github.rtarik.paintmixer.PaintMixers
import io.github.rtarik.paintmixer.SrgbColor
val mixer = PaintMixers.default()
val result = mixer.mixOrNull(
listOf(
MixPortion(color = SrgbColor.fromHex("#E53935"), parts = 1),
MixPortion(color = SrgbColor.fromHex("#283593"), parts = 1),
),
)
println(result?.toHexString())
Starts from a subtractive spectral mix instead of straight channel interpolation.
Compare the corrected result against the base engine to see exactly what the residual model adds.
Use the same model artifact and fixture corpus across JavaScript and Kotlin.
Technical
Dive into the two-stage pipeline, the shared artifact contract, and the reasoning behind the residual correction model.
Open technical pageRepository
Browse the source, release notes, and deployment workflows for the standalone library repository on GitHub.
Open GitHub repository