Expand description
Represents a 3-Byte RGB color value.
Fields
red: u8
green: u8
blue: u8
Implementations
sourceimpl Color
impl Color
sourcepub fn into_pro_hotcue_color(self) -> Self
pub fn into_pro_hotcue_color(self) -> Self
Return the corresponding Serato DJ Pro Hotcue color for this color.
Hotcue colors stored in Serato’s metadata are not necessarily the same as displayed in the UI. Serato DJ Intro/Pro/Lite always stores colors as shown in the legacy Serato DJ Intro.
Serato DJ Pro and Lite then map the stored color to their own color palette. If the color is not in the palette, this returns the color unchanged.
use triseratops::tag::color::Color;
// This color is in the Serato DJ Intro palette...
let intro_color = Color { red: 0xCC, green: 0x88, blue: 0x00 };
let pro_color = intro_color.into_pro_hotcue_color();
assert_eq!(pro_color, Color { red: 0xF8, green: 0x82, blue: 0x1A });
// ... and this color isn't.
let non_intro_color = Color { red: 0xC0, green: 0xFF, blue: 0xEE };
let non_pro_color = non_intro_color.into_pro_hotcue_color();
assert_eq!(non_pro_color, Color { red: 0xC0, green: 0xFF, blue: 0xEE });
sourcepub fn into_intro_hotcue_color(self) -> Self
pub fn into_intro_hotcue_color(self) -> Self
Return the corresponding Serato DJ Intro Hotcue (i.e. Metadata) color for this color.
Hotcue colors stored in Serato’s metadata are not necessarily the same as displayed in the UI. Serato DJ Intro/Pro/Lite always stores colors as shown in the legacy Serato DJ Intro.
Serato DJ Pro and Lite then map the stored color to their own color palette. If the color is not in the palette, this returns the color unchanged.
use triseratops::tag::color::Color;
// This color is in the Serato DJ Pro palette...
let pro_color = Color { red: 0xF8, green: 0x82, blue: 0x1A };
let intro_color = pro_color.into_intro_hotcue_color();
assert_eq!(intro_color, Color { red: 0xCC, green: 0x88, blue: 0x00 });
// ... and this color isn't.
let non_pro_color = Color { red: 0xC0, green: 0xFF, blue: 0xEE };
let non_intro_color = non_pro_color.into_intro_hotcue_color();
assert_eq!(non_intro_color, Color { red: 0xC0, green: 0xFF, blue: 0xEE });
sourcepub fn into_displayed_track_color(self) -> Option<Self>
pub fn into_displayed_track_color(self) -> Option<Self>
Return the displayed track color from the stored track color value.
Serato stores Track colors differently from how they are displayed in the library column. Instead of the color from the library view, the value from the color picker is stored instead (which is different).
use triseratops::tag::color::Color;
let stored_color = Color { red: 0xFF, green: 0x99, blue: 0xFF };
let displayed_color = stored_color.into_displayed_track_color();
assert_eq!(displayed_color, Some(Color {red: 0x99, green: 0x33, blue: 0x99 }));
let stored_color = Color { red: 0xFF, green: 0xFF, blue: 0xFF };
let displayed_color = stored_color.into_displayed_track_color();
assert_eq!(displayed_color, None);
sourcepub fn from_displayed_track_color(color: Option<Self>) -> Self
pub fn from_displayed_track_color(color: Option<Self>) -> Self
Return the stored track color from the displayed track color value.
Serato stores Track colors differently from how they are displayed in the library column. Instead of the color from the library view, the value from the color picker is stored instead (which is different).
use triseratops::tag::color::Color;
let displayed_color = Color {red: 0x99, green: 0x33, blue: 0x99 };
let stored_color = Color::from_displayed_track_color(Some(displayed_color));
assert_eq!(stored_color, Color { red: 0xFF, green: 0x99, blue: 0xFF });
let stored_color = Color::from_displayed_track_color(None);
assert_eq!(stored_color, Color { red: 0xFF, green: 0xFF, blue: 0xFF });
Trait Implementations
impl Copy for Color
impl StructuralPartialEq for Color
Auto Trait Implementations
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more