docx_reader/documents/elements/
shading.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use serde::Serialize;

use crate::types::*;

// INFO: Theme is not supported now.
#[derive(Serialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct Shading {
	pub shd_type: ShdType,
	pub color: String,
	pub fill: String,
}

impl Default for Shading {
	fn default() -> Self {
		Shading {
			shd_type: ShdType::Clear,
			color: "auto".to_owned(),
			fill: "FFFFFF".to_owned(),
		}
	}
}

impl Shading {
	pub fn new() -> Shading {
		Shading::default()
	}

	pub fn color(mut self, color: impl Into<String>) -> Shading {
		self.color = color.into();
		self
	}

	pub fn fill(mut self, fill: impl Into<String>) -> Shading {
		self.fill = fill.into();
		self
	}

	pub fn shd_type(mut self, shd_type: ShdType) -> Shading {
		self.shd_type = shd_type;
		self
	}
}