Skip to content

Commit 686fb9c

Browse files
committed
catch error
1 parent 44b1a54 commit 686fb9c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/textual/color.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,10 @@ def from_colors(cls, *colors: Color | str, quality: int = 50) -> Gradient:
600600
quality: The number of steps in the gradient.
601601
602602
Returns:
603-
_type_: _description_
603+
A new Gradient instance.
604604
"""
605+
if len(colors) < 2:
606+
raise ValueError("Two or more colors required.")
605607
stops = [(i / (len(colors) - 1), Color.parse(c)) for i, c in enumerate(colors)]
606608
return cls(*stops, quality=quality)
607609

0 commit comments

Comments
 (0)