MCPcopy
hub / github.com/callumalpass/tasknotes / colorValueToInputValue

Function colorValueToInputValue

src/utils/themeColors.ts:48–58  ·  view source on GitHub ↗
(value: string | null | undefined)

Source from the content-addressed store, hash-verified

46}
47
48export 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
60export function isCssVariableColor(value: string | null | undefined): boolean {
61 return normalizeThemeColor(value).startsWith("var(");

Callers 6

onOpenMethod · 0.90
onOpenMethod · 0.90
createThemeColorInputFunction · 0.90
readThemeColorInputFunction · 0.90
renderFeaturesTabFunction · 0.90

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected