13 lines
457 B
TypeScript
13 lines
457 B
TypeScript
export function parseVmlColorForDrawing(raw: string | undefined): string | undefined {
|
|
if (!raw) return undefined
|
|
const trimmed = raw.trim()
|
|
if (trimmed.startsWith("#") && trimmed.length === 7) return trimmed
|
|
if (/^[0-9a-f]{6}$/i.test(trimmed)) return `#${trimmed}`
|
|
return undefined
|
|
}
|
|
|
|
export function parseRotationDegFromStyle(style: string): number {
|
|
const match = style.match(/\brotation:\s*(-?\d+)/i)
|
|
return match ? Number(match[1]) : 0
|
|
}
|