You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the other hand, if you pass both `fromColor` and `toColor`, the method performs a **linear interpolation** between the two colors. The same text will always map to the same position in the gradient between the colors, creating a deterministic color that falls somewhere on the line connecting the two provided colors.
235
+
236
+
```php
237
+
/** @var HslColor $hslColor - Color interpolated between light green and dark teal */
238
+
$hslColor = colority()->textToColor(
239
+
"Hi, I'm Tomás",
240
+
colority()->fromHex('#85d5a4'), // Light green (start point)
241
+
colority()->fromHex('#165a59') // Dark teal (end point)
242
+
);
243
+
```
244
+
245
+
This interpolation approach is particularly useful for creating **consistent color themes** where you want all generated colors to harmonize within a specific palette range.
246
+
226
247
> **🧙 Advise**
227
248
> Useful for generating a color associated with, for example, **a username, mail address, etc**, since a string will always return the same color.
0 commit comments