Skip to content

Commit 250e11d

Browse files
committed
Revert changing RGBA struct name
1 parent c685ccd commit 250e11d

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/color.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn serialize_alpha(dest: &mut impl fmt::Write, alpha: f32, legacy_syntax: bool)
3434
/// A color with red, green, blue, and alpha components, in a byte each.
3535
#[derive(Clone, Copy, PartialEq, Debug)]
3636
#[repr(C)]
37-
pub struct Rgba {
37+
pub struct RGBA {
3838
/// The red component.
3939
pub red: u8,
4040
/// The green component.
@@ -45,7 +45,7 @@ pub struct Rgba {
4545
pub alpha: f32,
4646
}
4747

48-
impl Rgba {
48+
impl RGBA {
4949
/// Constructs a new RGBA value from float components. It expects the red,
5050
/// green, blue and alpha channels in that order, and all values will be
5151
/// clamped to the 0.0 ... 1.0 range.
@@ -134,7 +134,7 @@ impl Rgba {
134134
}
135135

136136
#[cfg(feature = "serde")]
137-
impl Serialize for Rgba {
137+
impl Serialize for RGBA {
138138
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
139139
where
140140
S: Serializer,
@@ -144,17 +144,17 @@ impl Serialize for Rgba {
144144
}
145145

146146
#[cfg(feature = "serde")]
147-
impl<'de> Deserialize<'de> for Rgba {
147+
impl<'de> Deserialize<'de> for RGBA {
148148
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
149149
where
150150
D: Deserializer<'de>,
151151
{
152152
let (r, g, b, a) = Deserialize::deserialize(deserializer)?;
153-
Ok(Rgba::new(r, g, b, a))
153+
Ok(RGBA::new(r, g, b, a))
154154
}
155155
}
156156

157-
impl ToCss for Rgba {
157+
impl ToCss for RGBA {
158158
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
159159
where
160160
W: fmt::Write,
@@ -355,7 +355,7 @@ impl_lch_like!(Oklch, "oklch");
355355
#[derive(Clone, Copy, PartialEq, Debug)]
356356
pub 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.
@@ -407,7 +407,7 @@ pub(crate) const fn rgb(red: u8, green: u8, blue: u8) -> Color {
407407

408408
#[inline]
409409
pub(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.
@@ -565,7 +565,7 @@ impl Color {
565565
let location = input.current_source_location();
566566
let token = input.next()?;
567567
match *token {
568-
Token::Hash(ref value) | Token::IDHash(ref value) => Rgba::parse_hash(value.as_bytes())
568+
Token::Hash(ref value) | Token::IDHash(ref value) => RGBA::parse_hash(value.as_bytes())
569569
.map(|rgba| Color::Absolute(AbsoluteColor::Rgba(rgba))),
570570
Token::Ident(ref value) => parse_color_keyword(&*value),
571571
Token::Function(ref name) => {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn parse_border_spacing(_context: &ParserContext, input: &mut Parser)
6969

7070
pub use crate::color::{
7171
hsl_to_rgb, hwb_to_rgb, parse_color_keyword, AbsoluteColor, AngleOrNumber, Color,
72-
ColorComponentParser, Lab, Lch, NumberOrPercentage, Oklab, Oklch, Rgba,
72+
ColorComponentParser, Lab, Lch, NumberOrPercentage, Oklab, Oklch, RGBA,
7373
};
7474
pub use crate::cow_rc_str::CowRcStr;
7575
pub use crate::from_bytes::{stylesheet_encoding, EncodingSupport};

src/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use super::{
1717
parse_important, parse_nth, parse_one_declaration, parse_one_rule, stylesheet_encoding,
1818
AbsoluteColor, AtRuleParser, BasicParseError, BasicParseErrorKind, Color, CowRcStr,
1919
DeclarationListParser, DeclarationParser, Delimiter, EncodingSupport, ParseError,
20-
ParseErrorKind, Parser, ParserInput, ParserState, QualifiedRuleParser, Rgba, RuleListParser,
21-
SourceLocation, ToCss, Token, TokenSerializationType, UnicodeRange,
20+
ParseErrorKind, Parser, ParserInput, ParserState, QualifiedRuleParser, RuleListParser,
21+
SourceLocation, ToCss, Token, TokenSerializationType, UnicodeRange, RGBA,
2222
};
2323

2424
macro_rules! JArray {
@@ -551,7 +551,7 @@ fn serialize_rgba() {
551551

552552
#[test]
553553
fn serialize_rgba_two_digit_float_if_roundtrips() {
554-
let c = Color::Absolute(AbsoluteColor::Rgba(Rgba::from_floats(0., 0., 0., 0.5)));
554+
let c = Color::Absolute(AbsoluteColor::Rgba(RGBA::from_floats(0., 0., 0., 0.5)));
555555
assert_eq!(c.to_css_string(), "rgba(0, 0, 0, 0.5)");
556556
}
557557

0 commit comments

Comments
 (0)