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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Fancy lists in the style of Pandoc. | |
--- | |
# A Python implementation of John Gruber's Markdown. | |
# Started by Manfred Stienstra (http://www.dwerg.net/). | |
# Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). | |
# Currently maintained by Waylan Limberg (https://github.com/waylan), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pragma: init | |
from __future__ import annotations | |
from coloraide.spaces.okhsl import Okhsl, okhsl_to_oklab, oklab_to_okhsl | |
from coloraide.spaces.okhsv import Okhsv, okhsv_to_oklab, oklab_to_okhsv | |
P3L_TO_LMS = [ | |
[0.4813798527499543, 0.4621183710113182, 0.05650177623872754], | |
[0.2288319418112447, 0.6532168193835677, 0.11795123880518772], | |
[0.08394575232299314, 0.22416527097756647, 0.6918889766994405] | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from coloraide.gamut import Fit | |
from coloraide.spaces import RGBish | |
from coloraide import algebra as alg | |
class OkLChScale(Fit): | |
""" | |
Gamut mapping by scaling. | |
Expected gamut mapping spaces are RGB type spaces. | |
For best results, linear light RGB spaces are preferred. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pragma: init | |
from coloraide.gamut import Fit | |
from coloraide.spaces import RGBish | |
class OkLChScale(Fit): | |
""" | |
Gamut mapping by scaling. | |
Expected gamut mapping spaces are RGB type spaces. | |
For best results, linear light RGB spaces are preferred. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pragma: init | |
from coloraide.gamut import Fit | |
from coloraide.spaces import RGBish | |
from coloraide import algebra as alg | |
class OkLChScale(Fit): | |
""" | |
Gamut mapping by scaling. | |
Expected gamut mapping spaces are RGB type spaces. |
HCT is a color model developed by [Google][material-hct]. It aims to solve a problem related to generating color palettes with good contrast. While HCT may seem like a revolutionary color model, the idea behind it is quite simple, take the perceptually uniform color model CAM16 and combine it with the CIE Lab's lightness.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from coloraide import Color as Base | |
class Color(Base): | |
FIT = 'oklch-chroma' | |
POWERLESS = True | |
CARRYFORWARD = True | |
print('==== Case 1 ====') | |
color = Color.interpolate(['oklch(100% 50% 60deg)', 'oklch(50% 50% 0deg)'], space='oklch', out_space='oklch')(0.5) | |
Row([color.to_string(percent=True), color.convert('srgb').to_string()]) |
NewerOlder