(value: string | null | undefined)
| 46 | } |
| 47 | |
| 48 | export function colorValueToInputValue(value: string | null | undefined): string { |
| 49 | const trimmed = value?.trim() ?? ""; |
| 50 | const match = trimmed.match(CSS_VARIABLE_PATTERN); |
| 51 | if (!match) return trimmed; |
| 52 | |
| 53 | const variableName = match[1].toLowerCase(); |
| 54 | if (variableName === "--color-accent") return "accent"; |
| 55 | |
| 56 | const colorName = variableName.replace(/^--color-/, ""); |
| 57 | return OBSIDIAN_THEME_COLOR_SET.has(colorName) ? colorName : trimmed; |
| 58 | } |
| 59 | |
| 60 | export function isCssVariableColor(value: string | null | undefined): boolean { |
| 61 | return normalizeThemeColor(value).startsWith("var("); |
no test coverage detected