This implements the gamut mapping algorithm according to CSS Level 4 specification.
from coloraide.gamut import Fit
from coloraide.util import NaN
class OklchChroma(Fit):
"""Lch chroma gamut mapping class."""
| from coloraide.gamut import Fit, clip_channels | |
| from coloraide.util import NaN | |
| class OklchChroma(Fit): | |
| """Lch chroma gamut mapping class.""" | |
| NAME = "oklch-chroma" | |
| EPSILON = 0.0001 |
This implements the gamut mapping algorithm according to CSS Level 4 specification.
from coloraide.gamut import Fit
from coloraide.util import NaN
class OklchChroma(Fit):
"""Lch chroma gamut mapping class."""
| from coloraide.distance.delta_e_76 import DE76 | |
| from coloraide.gamut.fit_lch_chroma import LchChroma | |
| from coloraide import Color as OrigColor | |
| class DEOK(DE76): | |
| """Delta E OK class.""" | |
| NAME = "ok" | |
| SPACE = "oklab" |
ColorAide's documentation is rendered with Python Markdown and Pymdown Extensions. The color notebook implements a dynamic, live environment allowing for on the fly page rendering and interactive Python code examples with beautiful visualization of color. This is accomplished by using Pyodide to execute the required Python modules to render the desired pages.
Though Pyodide is used to run the Python code, the actual code is handled special so that we can intercept color objects at various times and translate them to color swatches and gradients. Because of this, asynchrounous code is not really handled
| """ | |
| Okhsl class. | |
| Translation to/from Oklab is licenced under MIT by the original author, all | |
| other code also licensed under MIT: Copyright (c) 2021 Isaac Muse. | |
| ---- Oklab license ---- | |
| Copyright (c) 2021 Björn Ottosson |
| """ | |
| HSLuv and HPLuv. | |
| Adapted to Python and ColorAide by Isaac Muse (2021) | |
| --- HSLuv Conversion Algorithm --- | |
| Copyright (c) 2012-2021 Alexei Boronine | |
| Copyright (c) 2016 Florian Dormont |
| """ | |
| Din99o class. | |
| https://de.wikipedia.org/wiki/DIN99-Farbraum | |
| """ | |
| from coloraide.spaces import RE_DEFAULT_MATCH | |
| from coloraide.spaces.xyz import XYZ | |
| from coloraide.spaces.lch.base import LchBase | |
| from coloraide.spaces.lab.base import LabBase, lab_to_xyz, xyz_to_lab | |
| from coloraide import util |
| """ | |
| Luv and Lch class. | |
| https://en.wikipedia.org/wiki/CIELUV | |
| """ | |
| from coloraide.spaces import Space, RE_DEFAULT_MATCH, GamutUnbound, Percent, WHITES, Cylindrical, Angle | |
| from coloraide.spaces.xyz import XYZ | |
| from coloraide import util | |
| from coloraide import Color as ColorOrig | |
| import copy |
| """Override default highlighter to handle shebangs.""" | |
| import re | |
| RE_SHEBANG = re.compile(r'\A\#!(\w+)\b\s*\r?\n') | |
| def md_shebang(src="", language="", class_name=None, options=None, md="", **kwargs): | |
| """Formatter wrapper.""" | |
| try: |
| """ | |
| File Strip. | |
| Licensed under MIT | |
| Copyright (c) 2012 - 2019 Isaac Muse <isaacmuse@gmail.com> | |
| """ | |
| import re | |
| LINE_PRESERVE = re.compile(r"\r?\n", re.MULTILINE) | |
| JSON_COMMENTS_PATTERN = re.compile( |