aboutsummaryrefslogtreecommitdiff
path: root/src/style/color.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/style/color.rs')
-rw-r--r--src/style/color.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/style/color.rs b/src/style/color.rs
index 14423ea..7e372cd 100644
--- a/src/style/color.rs
+++ b/src/style/color.rs
@@ -61,8 +61,10 @@ impl<T: Color> Color for &'_ T {
/// The RGBA representation of the color, Plotters use RGBA as the internal representation
/// of color
+///
+/// If you want to directly create a RGB color with transparency use [RGBColor::mix]
#[derive(Copy, Clone, PartialEq, Debug, Default)]
-pub struct RGBAColor(pub(crate) u8, pub(crate) u8, pub(crate) u8, pub(crate) f64);
+pub struct RGBAColor(pub u8, pub u8, pub u8, pub f64);
impl Color for RGBAColor {
#[inline(always)]
@@ -74,7 +76,14 @@ impl Color for RGBAColor {
}
}
+impl From<RGBColor> for RGBAColor {
+ fn from(rgb: RGBColor) -> Self {
+ Self(rgb.0, rgb.1, rgb.2, 1.0)
+ }
+}
+
/// A color in the given palette
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug, Default)]
pub struct PaletteColor<P: Palette>(usize, PhantomData<P>);
impl<P: Palette> PaletteColor<P> {
@@ -120,6 +129,7 @@ impl BackendStyle for RGBColor {
}
/// The color described by HSL color space
+#[derive(Copy, Clone, PartialEq, Debug, Default)]
pub struct HSLColor(pub f64, pub f64, pub f64);
impl Color for HSLColor {