Created
August 23, 2023 16:24
-
-
Save facelessuser/33db90eb8b688adc78d6940036f20abe to your computer and use it in GitHub Desktop.
CSS undefined handling
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()]) | |
print('==== Case 2 ====') | |
color = Color.interpolate(['oklch(75% 0% 60deg)', 'oklch(75% 50% 0deg)'], space='oklch', out_space='oklch')(0.5) | |
Row([color.to_string(percent=True), color.convert('srgb').to_string()]) | |
print('==== Case 3 ====') | |
color = Color.interpolate(['oklch(75% 0% none)', 'oklch(75% 50% 0deg)'], space='oklch', out_space='oklch')(0.5) | |
Row([color.to_string(percent=True), color.convert('srgb').to_string()]) | |
print('==== Case 4 ====') | |
color = Color.interpolate(['rgb(255, 255, 255)', 'rgb(180, 6, 95)'], space='oklch', out_space='oklch')(0.5) | |
Row([color.to_string(percent=True), color.convert('srgb').to_string()]) | |
print('==== Case 5 ====') | |
color = Color.interpolate(['oklch(75% 0% 60deg)', 'oklch(75% 50% 0deg)'], space='lch', out_space='oklch')(0.5) | |
Row([color.to_string(percent=True), color.convert('srgb').to_string()]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment