diff options
| author | frozolotl <44589151+frozolotl@users.noreply.github.com> | 2023-11-10 10:31:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-10 10:31:06 +0100 |
| commit | d93ed1b3d8c12768f9c066ba13ac3143a43ebbf8 (patch) | |
| tree | 99b6883a6f1d35fe53cdca87f56883bdfb151f7a /tests/typ | |
| parent | 7f0fcda3764e261612021e5ec66d536bb5ee98ef (diff) | |
Implement Oklch support (#2611)
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/compiler/color.typ | 8 | ||||
| -rw-r--r-- | tests/typ/compiler/methods.typ | 5 | ||||
| -rw-r--r-- | tests/typ/compiler/repr-color-gradient.typ | 1 | ||||
| -rw-r--r-- | tests/typ/compute/construct.typ | 22 |
4 files changed, 31 insertions, 5 deletions
diff --git a/tests/typ/compiler/color.typ b/tests/typ/compiler/color.typ index 71fce1b1..86dd1542 100644 --- a/tests/typ/compiler/color.typ +++ b/tests/typ/compiler/color.typ @@ -24,6 +24,7 @@ #box(square(size: 9pt, fill: col)) #box(square(size: 9pt, fill: rgb(col))) #box(square(size: 9pt, fill: oklab(col))) +#box(square(size: 9pt, fill: oklch(col))) #box(square(size: 9pt, fill: luma(col))) #box(square(size: 9pt, fill: cmyk(col))) #box(square(size: 9pt, fill: color.linear-rgb(col))) @@ -34,16 +35,19 @@ // Test hue rotation #let col = rgb(50%, 64%, 16%) +// Oklch #for x in range(0, 11) { box(square(size: 9pt, fill: rgb(col).rotate(x * 36deg))) } +// HSL #for x in range(0, 11) { - box(square(size: 9pt, fill: color.hsv(col).rotate(x * 36deg))) + box(square(size: 9pt, fill: rgb(col).rotate(x * 36deg, space: color.hsl))) } +// HSV #for x in range(0, 11) { - box(square(size: 9pt, fill: color.hsl(col).rotate(x * 36deg))) + box(square(size: 9pt, fill: rgb(col).rotate(x * 36deg, space: color.hsv))) } --- diff --git a/tests/typ/compiler/methods.typ b/tests/typ/compiler/methods.typ index f7e7ed8f..0ae17ae7 100644 --- a/tests/typ/compiler/methods.typ +++ b/tests/typ/compiler/methods.typ @@ -108,6 +108,7 @@ #test-repr(luma(40).components(), (15.69%, )) #test-repr(cmyk(4%, 5%, 6%, 7%).components(), (4%, 5%, 6%, 7%)) #test-repr(oklab(10%, 0.2, 0.3).components(), (10%, 0.2, 0.3, 100%)) +#test-repr(oklch(10%, 0.2, 90deg).components(), (10%, 0.2, 90deg, 100%)) #test-repr(color.linear-rgb(10%, 20%, 30%).components(), (10%, 20%, 30%, 100%)) #test-repr(color.hsv(10deg, 20%, 30%).components(), (10deg, 20%, 30%, 100%)) #test-repr(color.hsl(10deg, 20%, 30%).components(), (10deg, 20%, 30%, 100%)) @@ -131,6 +132,9 @@ #test-repr(color.hsv(rgb(1, 2, 3)), color.hsv(-150deg, 66.67%, 1.18%)) #test-repr(oklab(luma(40)).components(), (27.68%, 0.0, 0.0, 100%)) #test-repr(oklab(rgb(1, 2, 3)).components(), (8.23%, -0.004, -0.007, 100%)) +#test-repr(oklch(oklab(40%, 0.2, 0.2)).components(), (40%, 0.283, 45deg, 100%)) +#test-repr(oklch(luma(40)).components(), (27.68%, 0.0, 72.49deg, 100%)) +#test-repr(oklch(rgb(1, 2, 3)).components(), (8.23%, 0.008, 240.75deg, 100%)) --- // Test gradient functions. @@ -143,6 +147,7 @@ #test(gradient.linear(red, green, blue, space: rgb).sample(100%), blue) #test(gradient.linear(red, green, space: rgb).space(), rgb) #test(gradient.linear(red, green, space: oklab).space(), oklab) +#test(gradient.linear(red, green, space: oklch).space(), oklch) #test(gradient.linear(red, green, space: cmyk).space(), cmyk) #test(gradient.linear(red, green, space: luma).space(), luma) #test(gradient.linear(red, green, space: color.linear-rgb).space(), color.linear-rgb) diff --git a/tests/typ/compiler/repr-color-gradient.typ b/tests/typ/compiler/repr-color-gradient.typ index d1c639c0..ef158974 100644 --- a/tests/typ/compiler/repr-color-gradient.typ +++ b/tests/typ/compiler/repr-color-gradient.typ @@ -7,6 +7,7 @@ #blue \ #color.linear-rgb(blue) \ #oklab(blue) \ +#oklch(blue) \ #cmyk(blue) \ #color.hsl(blue) \ #color.hsv(blue) \ diff --git a/tests/typ/compute/construct.typ b/tests/typ/compute/construct.typ index 58693a49..f6856c6f 100644 --- a/tests/typ/compute/construct.typ +++ b/tests/typ/compute/construct.typ @@ -37,6 +37,7 @@ #test(rgb(rgb(10, 20, 30)).space(), rgb) #test(color.linear-rgb(rgb(10, 20, 30)).space(), color.linear-rgb) #test(oklab(rgb(10, 20, 30)).space(), oklab) +#test(oklch(rgb(10, 20, 30)).space(), oklch) #test(color.hsl(rgb(10, 20, 30)).space(), color.hsl) #test(color.hsv(rgb(10, 20, 30)).space(), color.hsv) #test(cmyk(rgb(10, 20, 30)).space(), cmyk) @@ -45,6 +46,7 @@ #test(rgb(color.linear-rgb(10, 20, 30)).space(), rgb) #test(color.linear-rgb(color.linear-rgb(10, 20, 30)).space(), color.linear-rgb) #test(oklab(color.linear-rgb(10, 20, 30)).space(), oklab) +#test(oklch(color.linear-rgb(10, 20, 30)).space(), oklch) #test(color.hsl(color.linear-rgb(10, 20, 30)).space(), color.hsl) #test(color.hsv(color.linear-rgb(10, 20, 30)).space(), color.hsv) #test(cmyk(color.linear-rgb(10, 20, 30)).space(), cmyk) @@ -53,14 +55,25 @@ #test(rgb(oklab(10%, 20%, 30%)).space(), rgb) #test(color.linear-rgb(oklab(10%, 20%, 30%)).space(), color.linear-rgb) #test(oklab(oklab(10%, 20%, 30%)).space(), oklab) +#test(oklch(oklab(10%, 20%, 30%)).space(), oklch) #test(color.hsl(oklab(10%, 20%, 30%)).space(), color.hsl) #test(color.hsv(oklab(10%, 20%, 30%)).space(), color.hsv) #test(cmyk(oklab(10%, 20%, 30%)).space(), cmyk) #test(luma(oklab(10%, 20%, 30%)).space(), luma) +#test(rgb(oklch(60%, 40%, 0deg)).space(), rgb) +#test(color.linear-rgb(oklch(60%, 40%, 0deg)).space(), color.linear-rgb) +#test(oklab(oklch(60%, 40%, 0deg)).space(), oklab) +#test(oklch(oklch(60%, 40%, 0deg)).space(), oklch) +#test(color.hsl(oklch(60%, 40%, 0deg)).space(), color.hsl) +#test(color.hsv(oklch(60%, 40%, 0deg)).space(), color.hsv) +#test(cmyk(oklch(60%, 40%, 0deg)).space(), cmyk) +#test(luma(oklch(60%, 40%, 0deg)).space(), luma) + #test(rgb(color.hsl(10deg, 20%, 30%)).space(), rgb) #test(color.linear-rgb(color.hsl(10deg, 20%, 30%)).space(), color.linear-rgb) #test(oklab(color.hsl(10deg, 20%, 30%)).space(), oklab) +#test(oklch(color.hsl(10deg, 20%, 30%)).space(), oklch) #test(color.hsl(color.hsl(10deg, 20%, 30%)).space(), color.hsl) #test(color.hsv(color.hsl(10deg, 20%, 30%)).space(), color.hsv) #test(cmyk(color.hsl(10deg, 20%, 30%)).space(), cmyk) @@ -69,6 +82,7 @@ #test(rgb(color.hsv(10deg, 20%, 30%)).space(), rgb) #test(color.linear-rgb(color.hsv(10deg, 20%, 30%)).space(), color.linear-rgb) #test(oklab(color.hsv(10deg, 20%, 30%)).space(), oklab) +#test(oklch(color.hsv(10deg, 20%, 30%)).space(), oklch) #test(color.hsl(color.hsv(10deg, 20%, 30%)).space(), color.hsl) #test(color.hsv(color.hsv(10deg, 20%, 30%)).space(), color.hsv) #test(cmyk(color.hsv(10deg, 20%, 30%)).space(), cmyk) @@ -77,6 +91,7 @@ #test(rgb(cmyk(10%, 20%, 30%, 40%)).space(), rgb) #test(color.linear-rgb(cmyk(10%, 20%, 30%, 40%)).space(), color.linear-rgb) #test(oklab(cmyk(10%, 20%, 30%, 40%)).space(), oklab) +#test(oklch(cmyk(10%, 20%, 30%, 40%)).space(), oklch) #test(color.hsl(cmyk(10%, 20%, 30%, 40%)).space(), color.hsl) #test(color.hsv(cmyk(10%, 20%, 30%, 40%)).space(), color.hsv) #test(cmyk(cmyk(10%, 20%, 30%, 40%)).space(), cmyk) @@ -85,6 +100,7 @@ #test(rgb(luma(10%)).space(), rgb) #test(color.linear-rgb(luma(10%)).space(), color.linear-rgb) #test(oklab(luma(10%)).space(), oklab) +#test(oklch(luma(10%)).space(), oklch) #test(color.hsl(luma(10%)).space(), color.hsl) #test(color.hsv(luma(10%)).space(), color.hsv) #test(cmyk(luma(10%)).space(), cmyk) @@ -130,15 +146,15 @@ #color.mix((red, 1, 2)) --- -// Error: 31-38 expected `rgb`, `luma`, `cmyk`, `oklab`, `color.linear-rgb`, `color.hsl`, or `color.hsv`, found string +// Error: 31-38 expected `rgb`, `luma`, `cmyk`, `oklab`, `oklch`, `color.linear-rgb`, `color.hsl`, or `color.hsv`, found string #color.mix(red, green, space: "cyber") --- -// Error: 31-36 expected `rgb`, `luma`, `cmyk`, `oklab`, `color.linear-rgb`, `color.hsl`, or `color.hsv` +// Error: 31-36 expected `rgb`, `luma`, `cmyk`, `oklab`, `oklch`, `color.linear-rgb`, `color.hsl`, or `color.hsv` #color.mix(red, green, space: image) --- -// Error: 31-41 expected `rgb`, `luma`, `cmyk`, `oklab`, `color.linear-rgb`, `color.hsl`, or `color.hsv` +// Error: 31-41 expected `rgb`, `luma`, `cmyk`, `oklab`, `oklch`, `color.linear-rgb`, `color.hsl`, or `color.hsv` #color.mix(red, green, space: calc.round) --- |
