@@ -118,6 +118,24 @@ def shades_of_blue(value: int, _: int) -> Color:
118118 return BLUES [value % 16 ]
119119
120120
121+ ##############################################################################
122+ @lru_cache
123+ def gradient (* stops : tuple [float , Color ], quality : int ) -> Gradient :
124+ """Create a Textual `Gradient`.
125+
126+ Args:
127+ stops: Color stops.
128+ quality: The number of steps in the gradient.
129+
130+ Returns:
131+ The gradient.
132+
133+ Raises:
134+ ValueError: If any stops are missing (must be at least a stop for 0 and 1).
135+ """
136+ return Gradient (* stops , quality = quality )
137+
138+
121139##############################################################################
122140@lru_cache
123141def blues_and_pinks (value : int , max_iteration : int ) -> Color :
@@ -130,7 +148,7 @@ def blues_and_pinks(value: int, max_iteration: int) -> Color:
130148 The colour to plot the point with.
131149 """
132150 return (
133- Gradient (
151+ gradient (
134152 (0 , Color (245 , 169 , 184 )),
135153 (0.125 , Color (91 , 206 , 250 )),
136154 (0.25 , Color (245 , 169 , 184 )),
@@ -159,7 +177,7 @@ def rainbow(value: int, max_iteration: int) -> Color:
159177 The colour to plot the point with.
160178 """
161179 return (
162- Gradient (
180+ gradient (
163181 (0 , Color (288 , 3 , 3 )),
164182 (0.2 , Color (255 , 140 , 0 )),
165183 (0.4 , Color (255 , 237 , 0 )),
0 commit comments