fix(color): fix doc test for from_hsl (#1421)

This commit is contained in:
Josh McKinney 2024-10-15 03:08:52 -07:00 committed by GitHub
parent 4728f0e68b
commit b7e488507d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -383,11 +383,13 @@ impl Color {
/// ```
/// use ratatui::{palette::Hsl, style::Color};
///
/// let color: Color = Color::from_hsl(Hsl::new(360.0, 100.0, 100.0));
/// assert_eq!(color, Color::Rgb(255, 255, 255));
///
/// // Black
/// let color: Color = Color::from_hsl(Hsl::new(0.0, 0.0, 0.0));
/// assert_eq!(color, Color::Rgb(0, 0, 0));
///
/// // White - note: 100% saturation is not converted to white
/// let color: Color = Color::from_hsl(Hsl::new(0.0, 0.0, 100.0));
/// assert_eq!(color, Color::Rgb(255, 255, 255));
/// ```
#[cfg(feature = "palette")]
pub fn from_hsl(hsl: palette::Hsl) -> Self {