Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix: fix invalid color str in paste (#2783)

ybzkyd0ac9042f693
diff --git a/packages/ui/src/utils/cell.ts b/packages/ui/src/utils/cell.ts
index cd8f943738..42e1229e16 100644
--- a/packages/ui/src/utils/cell.ts
+++ b/packages/ui/src/utils/cell.ts
@@ -205,9 +205,9 @@ export function handleStringToStyle($dom?: HTMLElement, cssStyle: string = '') {
}
// font color
else if (key === 'color') {
- const rgbStr = new ColorKit(value).toRgbString();
+ const colorKit = new ColorKit(value);
styleList.cl = {
- rgb: rgbStr,
+ rgb: colorKit.isValid ? colorKit.toRgbString() : 'rgb(0,0,0)',
};
}
// fill color / background