Fix Oklab and Oklch color space inconsistency (#12583)
				
					
				
			# Objective Fixes #12224. ## Solution - Expand `with_` methods for the `Oklch` to their full names. - Expand `l` to `lightness` in `Oklaba` comments. ## Migration Guide The following methods have been renamed for the `Oklch` color space: - `with_l` -> `with_lightness`. - `with_c` -> `with_chroma`. - `with_h` -> `with_hue`.
This commit is contained in:
		
							parent
							
								
									40f82b867b
								
							
						
					
					
						commit
						f38895a414
					
				@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
 | 
				
			|||||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
 | 
					#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Reflect)]
 | 
				
			||||||
#[reflect(PartialEq, Serialize, Deserialize, Default)]
 | 
					#[reflect(PartialEq, Serialize, Deserialize, Default)]
 | 
				
			||||||
pub struct Oklaba {
 | 
					pub struct Oklaba {
 | 
				
			||||||
    /// The 'l' channel. [0.0, 1.0]
 | 
					    /// The 'lightness' channel. [0.0, 1.0]
 | 
				
			||||||
    pub lightness: f32,
 | 
					    pub lightness: f32,
 | 
				
			||||||
    /// The 'a' channel. [-1.0, 1.0]
 | 
					    /// The 'a' channel. [-1.0, 1.0]
 | 
				
			||||||
    pub a: f32,
 | 
					    pub a: f32,
 | 
				
			||||||
@ -61,7 +61,7 @@ impl Oklaba {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Return a copy of this color with the 'l' channel set to the given value.
 | 
					    /// Return a copy of this color with the 'lightness' channel set to the given value.
 | 
				
			||||||
    pub const fn with_lightness(self, lightness: f32) -> Self {
 | 
					    pub const fn with_lightness(self, lightness: f32) -> Self {
 | 
				
			||||||
        Self { lightness, ..self }
 | 
					        Self { lightness, ..self }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -56,17 +56,17 @@ impl Oklcha {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Return a copy of this color with the 'lightness' channel set to the given value.
 | 
					    /// Return a copy of this color with the 'lightness' channel set to the given value.
 | 
				
			||||||
    pub const fn with_l(self, lightness: f32) -> Self {
 | 
					    pub const fn with_lightness(self, lightness: f32) -> Self {
 | 
				
			||||||
        Self { lightness, ..self }
 | 
					        Self { lightness, ..self }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Return a copy of this color with the 'chroma' channel set to the given value.
 | 
					    /// Return a copy of this color with the 'chroma' channel set to the given value.
 | 
				
			||||||
    pub const fn with_c(self, chroma: f32) -> Self {
 | 
					    pub const fn with_chroma(self, chroma: f32) -> Self {
 | 
				
			||||||
        Self { chroma, ..self }
 | 
					        Self { chroma, ..self }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Return a copy of this color with the 'hue' channel set to the given value.
 | 
					    /// Return a copy of this color with the 'hue' channel set to the given value.
 | 
				
			||||||
    pub const fn with_h(self, hue: f32) -> Self {
 | 
					    pub const fn with_hue(self, hue: f32) -> Self {
 | 
				
			||||||
        Self { hue, ..self }
 | 
					        Self { hue, ..self }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user