drive_v3/objects/
drive_theme.rs

1use std::fmt;
2use serde::{Serialize, Deserialize};
3
4/// A list of themes that are supported for shared drives.
5#[derive(Default, Debug, Clone, Serialize, Deserialize)]
6#[serde(rename_all = "camelCase")]
7pub struct DriveTheme {
8    /// The ID of the theme.
9    #[serde(skip_serializing_if = "Option::is_none")]
10    pub id: Option<String>,
11
12    /// A link to this theme's background image.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub background_image_link: Option<String>,
15
16    /// The color of this theme as an RGB hex string.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub color_rgb: Option<String>,
19}
20
21impl fmt::Display for DriveTheme {
22    fn fmt( &self, f: &mut fmt::Formatter<'_> ) -> fmt::Result {
23        let json = serde_json::to_string_pretty(&self)
24            .unwrap_or( format!("unable to parse JSON, this is the debug view:\n{:#?}", self) );
25
26        write!(f, "{}", json)
27    }
28}
29
30impl DriveTheme {
31    /// Creates a new, empty instance of this struct.
32    pub fn new() -> Self {
33        Self { ..Default::default() }
34    }
35}