Skip to content

Commit

Permalink
Don’t use too recent math.cbrt
Browse files Browse the repository at this point in the history
It’s been added in Python 3.11 (!)
  • Loading branch information
liZe committed Jul 2, 2024
1 parent a9d5371 commit 95d681f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tinycss2/color4.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from colorsys import hls_to_rgb
from math import cbrt, cos, sin, tau
from math import cos, sin, tau

from .color3 import _BASIC_COLOR_KEYWORDS, _EXTENDED_COLOR_KEYWORDS, _HASH_REGEXPS
from .parser import parse_one_component_value
Expand Down Expand Up @@ -31,9 +31,9 @@ def _xyz_to_lab(X, Y, Z, d):
x = X / d[0]
y = Y / d[1]
z = Z / d[2]
f0 = cbrt(x) if x > else ( * x + 16) / 116
f1 = cbrt(y) if y > else ( * y + 16) / 116
f2 = cbrt(z) if z > else ( * z + 16) / 116
f0 = x ** (1 / 3) if x > else ( * x + 16) / 116
f1 = y ** (1 / 3) if y > else ( * y + 16) / 116
f2 = z ** (1 / 3) if z > else ( * z + 16) / 116
L = (116 * f1) - 16
a = 500 * (f0 - f1)
b = 200 * (f1 - f2)
Expand Down

0 comments on commit 95d681f

Please sign in to comment.