-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.ua
50 lines (43 loc) · 1.35 KB
/
lib.ua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
AssertColorType ↚ ⨬◌(
⨬(""|"complexes"|"characters"|"boxes")
⍤⊙0$"Argument must be an array of numbers, but it is _"
)⊸≠0type
AssertColorShape ↚ ⨬◌(
⍤⊙0$"Array must have length 3, but its shape is _"
)⊃(≠3⧻)△ ⟜AssertColorType
# Track caller!
SrgbToLinear ← ⌅(
⟜AssertColorType
⍜-× ⊃(÷12.92|ⁿ2.4÷1.055+0.055) ⟜(≥0.04045)
| ⟜AssertColorType
⍜-× ⊃(×12.92|-0.055×1.055ⁿ5/12) ⟜(≥0.0031308)
)
# Track caller!
OklabToLinear ← ⌅(
⟜AssertColorShape
[1_0.3963377774_0.2158037573
1_¯0.1055613458_¯0.0638541728
1_¯0.0894841775_¯1.291485548]
××..≡/+×⊙¤
[4.0767416621_¯3.3077115913_0.2309699292
¯1.2684380046_2.6097574011_¯0.3413193965
¯0.0041960863_¯0.7034186147_1.707614701]
≡/+×⊙¤
| ⟜AssertColorShape
[0.4122214708_0.5363325363_0.0514459929
0.2119034982_0.6806995451_0.1073969566
0.0883024619_0.2817188376_0.6299787005]
⍜⌵(ⁿ1/3)≡/+×⊙¤
[0.2104542553_0.793617785_¯0.0040720468
1.9779984951_¯2.428592205_0.4505937099
0.0259040371_0.7827717662_¯0.808675766]
≡/+×⊙¤
)
# Track caller!
LinearToSrgb ← °SrgbToLinear
# Track caller!
LinearToOklab ← °OklabToLinear
# Track caller!
OklabToSrgb ← LinearToSrgb OklabToLinear
# Track caller!
SrgbToOklab ← °OklabToSrgb