pub struct Color {
    pub red: u8,
    pub green: u8,
    pub blue: u8,
}
Expand description

Represents a 3-Byte RGB color value.

Fields

red: u8green: u8blue: u8

Implementations

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 });

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 });

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);

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.