feat: Support paragraph color (#761)
parent
60d94921b0
commit
6fdf81d1ba
|
@ -305,6 +305,11 @@ impl Paragraph {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn color(mut self, c: impl Into<String>) -> Self {
|
||||
self.property.run_property = self.property.run_property.color(c);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn bold(mut self) -> Self {
|
||||
self.property.run_property = self.property.run_property.bold();
|
||||
self
|
||||
|
|
|
@ -299,6 +299,10 @@ export const setParagraphProperty = <T extends wasm.Paragraph | wasm.Style>(
|
|||
target = target.bold() as T;
|
||||
}
|
||||
|
||||
if (property.runProperty.color) {
|
||||
target = target.color(property.runProperty.color) as T;
|
||||
}
|
||||
|
||||
if (typeof property.lineSpacing !== "undefined") {
|
||||
const spacing = buildLineSpacing(property);
|
||||
if (spacing) {
|
||||
|
|
|
@ -180,6 +180,11 @@ export class Paragraph {
|
|||
return this;
|
||||
}
|
||||
|
||||
color(color: string) {
|
||||
this.property.runProperty = { ...this.property.runProperty, color };
|
||||
return this;
|
||||
}
|
||||
|
||||
bold() {
|
||||
this.property.runProperty = { ...this.property.runProperty, bold: true };
|
||||
return this;
|
||||
|
|
|
@ -178,6 +178,11 @@ impl Paragraph {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn color(mut self, c: &str) -> Self {
|
||||
self.0 = self.0.color(c);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn bold(mut self) -> Self {
|
||||
self.0 = self.0.bold();
|
||||
self
|
||||
|
|
Loading…
Reference in New Issue