@@ -355,32 +355,32 @@ impl_lch_like!(Oklch, "oklch");
355355#[ derive( Clone , Copy , PartialEq , Debug ) ]
356356pub enum AbsoluteColor {
357357 /// Specify sRGB colors directly by their red/green/blue/alpha chanels.
358- RGBA ( Rgba ) ,
358+ Rgba ( Rgba ) ,
359359 /// Specifies a CIELAB color by CIE Lightness and its a- and b-axis hue
360360 /// coordinates (red/green-ness, and yellow/blue-ness) using the CIE LAB
361361 /// rectangular coordinate model.
362- LAB ( Lab ) ,
362+ Lab ( Lab ) ,
363363 /// Specifies a CIELAB color by CIE Lightness, Chroma, and hue using the
364364 /// CIE LCH cylindrical coordinate model.
365- LCH ( Lch ) ,
365+ Lch ( Lch ) ,
366366 /// Specifies an Oklab color by Oklab Lightness and its a- and b-axis hue
367367 /// coordinates (red/green-ness, and yellow/blue-ness) using the Oklab
368368 /// rectangular coordinate model.
369- OKLAB ( Oklab ) ,
369+ Oklab ( Oklab ) ,
370370 /// Specifies an Oklab color by Oklab Lightness, Chroma, and hue using
371371 /// the OKLCH cylindrical coordinate model.
372- OKLCH ( Oklch ) ,
372+ Oklch ( Oklch ) ,
373373}
374374
375375impl AbsoluteColor {
376376 /// Return the alpha component of any of the schemes within.
377377 pub fn alpha ( & self ) -> f32 {
378378 match self {
379- Self :: RGBA ( c) => c. alpha ,
380- Self :: LAB ( c) => c. alpha ,
381- Self :: LCH ( c) => c. alpha ,
382- Self :: OKLAB ( c) => c. alpha ,
383- Self :: OKLCH ( c) => c. alpha ,
379+ Self :: Rgba ( c) => c. alpha ,
380+ Self :: Lab ( c) => c. alpha ,
381+ Self :: Lch ( c) => c. alpha ,
382+ Self :: Oklab ( c) => c. alpha ,
383+ Self :: Oklch ( c) => c. alpha ,
384384 }
385385 }
386386}
@@ -391,11 +391,11 @@ impl ToCss for AbsoluteColor {
391391 W : fmt:: Write ,
392392 {
393393 match self {
394- Self :: RGBA ( rgba) => rgba. to_css ( dest) ,
395- Self :: LAB ( lab) => lab. to_css ( dest) ,
396- Self :: LCH ( lch) => lch. to_css ( dest) ,
397- Self :: OKLAB ( lab) => lab. to_css ( dest) ,
398- Self :: OKLCH ( lch) => lch. to_css ( dest) ,
394+ Self :: Rgba ( rgba) => rgba. to_css ( dest) ,
395+ Self :: Lab ( lab) => lab. to_css ( dest) ,
396+ Self :: Lch ( lch) => lch. to_css ( dest) ,
397+ Self :: Oklab ( lab) => lab. to_css ( dest) ,
398+ Self :: Oklch ( lch) => lch. to_css ( dest) ,
399399 }
400400 }
401401}
@@ -407,7 +407,7 @@ pub(crate) const fn rgb(red: u8, green: u8, blue: u8) -> Color {
407407
408408#[ inline]
409409pub ( crate ) const fn rgba ( red : u8 , green : u8 , blue : u8 , alpha : f32 ) -> Color {
410- Color :: Absolute ( AbsoluteColor :: RGBA ( Rgba :: new ( red, green, blue, alpha) ) )
410+ Color :: Absolute ( AbsoluteColor :: Rgba ( Rgba :: new ( red, green, blue, alpha) ) )
411411}
412412
413413/// A <color> value.
@@ -566,7 +566,7 @@ impl Color {
566566 let token = input. next ( ) ?;
567567 match * token {
568568 Token :: Hash ( ref value) | Token :: IDHash ( ref value) => Rgba :: parse_hash ( value. as_bytes ( ) )
569- . map ( |rgba| Color :: Absolute ( AbsoluteColor :: RGBA ( rgba) ) ) ,
569+ . map ( |rgba| Color :: Absolute ( AbsoluteColor :: Rgba ( rgba) ) ) ,
570570 Token :: Ident ( ref value) => parse_color_keyword ( & * value) ,
571571 Token :: Function ( ref name) => {
572572 let name = name. clone ( ) ;
@@ -806,25 +806,25 @@ where
806806 // for L: 0% = 0.0, 100% = 100.0
807807 // for a and b: -100% = -125, 100% = 125
808808 "lab" => parse_lab_like( component_parser, arguments, 100.0 , 125.0 , |l, a, b, alpha| {
809- Color :: Absolute ( AbsoluteColor :: LAB ( Lab :: new( l. max( 0. ) , a , b , alpha) ) )
809+ Color :: Absolute ( AbsoluteColor :: Lab ( Lab :: new( l. max( 0. ) , a , b , alpha) ) )
810810 } ) ,
811811
812812 // for L: 0% = 0.0, 100% = 100.0
813813 // for C: 0% = 0, 100% = 150
814814 "lch" => parse_lch_like( component_parser, arguments, 100.0 , 150.0 , |l, c, h, alpha| {
815- Color :: Absolute ( AbsoluteColor :: LCH ( Lch :: new( l. max( 0. ) , c. max( 0. ) , h, alpha) ) )
815+ Color :: Absolute ( AbsoluteColor :: Lch ( Lch :: new( l. max( 0. ) , c. max( 0. ) , h, alpha) ) )
816816 } ) ,
817817
818818 // for L: 0% = 0.0, 100% = 1.0
819819 // for a and b: -100% = -0.4, 100% = 0.4
820820 "oklab" => parse_lab_like( component_parser, arguments, 1.0 , 0.4 , |l, a, b, alpha| {
821- Color :: Absolute ( AbsoluteColor :: OKLAB ( Oklab :: new( l. max( 0. ) , a, b, alpha) ) )
821+ Color :: Absolute ( AbsoluteColor :: Oklab ( Oklab :: new( l. max( 0. ) , a, b, alpha) ) )
822822 } ) ,
823823
824824 // for L: 0% = 0.0, 100% = 1.0
825825 // for C: 0% = 0.0 100% = 0.4
826826 "oklch" => parse_lch_like( component_parser, arguments, 1.0 , 0.4 , |l, c, h, alpha| {
827- Color :: Absolute ( AbsoluteColor :: OKLCH ( Oklch :: new( l. max( 0. ) , c. max( 0. ) , h, alpha) ) )
827+ Color :: Absolute ( AbsoluteColor :: Oklch ( Oklch :: new( l. max( 0. ) , c. max( 0. ) , h, alpha) ) )
828828 } ) ,
829829
830830 _ => return Err ( arguments. new_unexpected_token_error( Token :: Ident ( name. to_owned( ) . into( ) ) ) ) ,
0 commit comments