mirror of
https://github.com/zadam/trilium.git
synced 2025-10-08 06:28:53 +08:00
6 lines
216 B
TypeScript
6 lines
216 B
TypeScript
export function rgb2hex(rgb: string) {
|
|
return `#${(rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/) || [])
|
|
.slice(1)
|
|
.map((n) => parseInt(n, 10).toString(16).padStart(2, "0"))
|
|
.join("")}`;
|
|
}
|