Skip to content

Instantly share code, notes, and snippets.

View facelessuser's full-sized avatar
💭
Screaming into the void 😱

Isaac Muse facelessuser

💭
Screaming into the void 😱
View GitHub Profile
@facelessuser
facelessuser / km.md
Created February 14, 2025 22:20
Kubelka-Munk Interpolation

Interpolation with Kubelka-Munk Theory

Approach

This is an experiment showcasing interpolation via Kubelka-Munk theory. Approach generally employs the method as outlined in Spectral.js. Most of foundational topics are covered in Mixbox's paper, though Spectral.js uses an approach less focused on specific paints and instead opts to generalize and simplify the approach by simply generating reflectance curves directly from the spectral data. Results don't necessarily mimic specific paints, but give a pigment like feel.

@facelessuser
facelessuser / spectraljs.py
Last active September 18, 2025 14:32
Spectral.js concentration fix
## MIT License
##
## Copyright (c) 2023 Ronald van Wijnen
##
## Permission is hereby granted, free of charge, to any person obtaining a
## copy of this software and associated documentation files (the "Software"),
## to deal in the Software without restriction, including without limitation
## the rights to use, copy, modify, merge, publish, distribute, sublicense,
## and/or sell copies of the Software, and to permit persons to whom the
## Software is furnished to do so, subject to the following conditions:
@facelessuser
facelessuser / spectraljs.py
Created September 19, 2025 20:41
Spectral.js with/without white spd
## MIT License
##
## Copyright (c) 2023 Ronald van Wijnen
##
## Permission is hereby granted, free of charge, to any person obtaining a
## copy of this software and associated documentation files (the "Software"),
## to deal in the Software without restriction, including without limitation
## the rights to use, copy, modify, merge, publish, distribute, sublicense,
## and/or sell copies of the Software, and to permit persons to whom the
## Software is furnished to do so, subject to the following conditions:
@facelessuser
facelessuser / msh.py
Last active December 1, 2025 22:15
Msh
"""
Msh color space.
Accounts for negative lightness and uses degrees for hue instead of radians.
- https://www.kennethmoreland.com/color-maps/ColorMapsExpanded.pdf
"""
import math
from coloraide import Color as Base
from coloraide import stop
@facelessuser
facelessuser / oktch.py
Last active August 11, 2026 03:06
OkTCh Tonal Pallets
"""OkTCh color space."""
from __future__ import annotations
import math
from coloraide import algebra as alg
from coloraide import util
from coloraide.cat import WHITES
from coloraide.channels import Channel, FLG_ANGLE
from coloraide.types import Vector
from coloraide.spaces.lab import y_to_lstar, lstar_to_y
from coloraide.spaces.lch import LCh