MCPcopy Create free account
hub / github.com/uiwjs/react-codemirror / themeCode

Function themeCode

www/src/pages/theme/editor/themeCode.ts:99–235  ·  view source on GitHub ↗
(styles: Partial<ThmeCodeStyle> = {})

Source from the content-addressed store, hash-verified

97export type ThmeCodeStyle = Style & CreateThemeOptions['settings'] & { dark: CreateThemeOptions['theme'] };
98
99export const themeCode = (styles: Partial<ThmeCodeStyle> = {}) => {
100 const data: string[] = [];
101 if (styles.comment) data.push(`{ tag: t.comment, color: '${styles.comment}' },`);
102 if (styles.lineComment) data.push(`{ tag: t.lineComment, color: '${styles.lineComment}' },`);
103 if (styles.blockComment) data.push(`{ tag: t.blockComment, color: '${styles.blockComment}' },`);
104 if (styles.docComment) data.push(`{ tag: t.docComment, color: '${styles.docComment}' },`);
105 if (styles.name) data.push(`{ tag: t.name, color: '${styles.name}' },`);
106 if (styles.typeDefinition) data.push(`{ tag: t.definition(t.typeName), color: '${styles.typeDefinition}' },`);
107 if (styles.typeName) data.push(`{ tag: t.typeName, color: '${styles.typeName}' },`);
108 if (styles.typeStandard) data.push(`{ tag: t.standard(t.typeName), color: '${styles.typeName}' },`);
109 if (styles.tagName) data.push(`{ tag: t.tagName, color: '${styles.tagName}' },`);
110 if (styles.tagNameStandard) data.push(`{ tag: t.standard(t.tagName), color: '${styles.tagNameStandard}' },`);
111 if (styles.variableName) data.push(`{ tag: t.variableName, color: '${styles.variableName}' },`);
112 if (styles.variableNameDefinition)
113 data.push(`{ tag: t.definition(t.variableName), color: '${styles.variableNameDefinition}' },`);
114 if (styles.variableNameFunction)
115 data.push(`{ tag: t.function(t.variableName), color: '${styles.variableNameFunction}' },`);
116 if (styles.propertyName) data.push(`{ tag: t.propertyName, color: '${styles.propertyName}' },`);
117 if (styles.propertyNameFunction)
118 data.push(`{ tag: t.function(t.propertyName), color: '${styles.propertyNameFunction}' },`);
119 if (styles.propertyNameDefinition)
120 data.push(`{ tag: t.definition(t.propertyName), color: '${styles.propertyNameDefinition}' },`);
121 if (styles.propertyNameSpecial)
122 data.push(`{ tag: t.special(t.propertyName), color: '${styles.propertyNameSpecial}' },`);
123 if (styles.attributeName) data.push(`{ tag: t.attributeName, color: '${styles.attributeName}' },`);
124 if (styles.className) data.push(`{ tag: t.className, color: '${styles.className}' },`);
125 if (styles.classNameConstant) data.push(`{ tag: t.constant(t.className), color: '${styles.className}' },`);
126 if (styles.labelName) data.push(`{ tag: t.labelName, color: '${styles.labelName}' },`);
127 if (styles.namespace) data.push(`{ tag: t.namespace, color: '${styles.namespace}' },`);
128 if (styles.macroName) data.push(`{ tag: t.macroName, color: '${styles.macroName}' },`);
129 if (styles.literal) data.push(`{ tag: t.literal, color: '${styles.literal}' },`);
130 if (styles.string) data.push(`{ tag: t.string, color: '${styles.string}' },`);
131 if (styles.stringSpecial) data.push(`{ tag: t.special(t.string), color: '${styles.stringSpecial}' },`);
132 if (styles.docString) data.push(`{ tag: t.docString, color: '${styles.docString}' },`);
133 if (styles.character) data.push(`{ tag: t.character, color: '${styles.character}' },`);
134 if (styles.attributeValue) data.push(`{ tag: t.attributeValue, color: '${styles.attributeValue}' },`);
135 if (styles.number) data.push(`{ tag: t.number, color: '${styles.number}' },`);
136 if (styles.integer) data.push(`{ tag: t.integer, color: '${styles.integer}' },`);
137 if (styles.float) data.push(`{ tag: t.float, color: '${styles.float}' },`);
138 if (styles.bool) data.push(`{ tag: t.bool, color: '${styles.bool}' },`);
139 if (styles.regexp) data.push(`{ tag: t.regexp, color: '${styles.regexp}' },`);
140 if (styles.escape) data.push(`{ tag: t.escape, color: '${styles.escape}' },`);
141 if (styles.color) data.push(`{ tag: t.color, color: '${styles.color}' },`);
142 if (styles.url) data.push(`{ tag: t.url, color: '${styles.url}' },`);
143 if (styles.keyword) data.push(`{ tag: t.keyword, color: '${styles.keyword}' },`);
144 if (styles.self) data.push(`{ tag: t.self, color: '${styles.self}' },`);
145 if (styles.null) data.push(`{ tag: t.null, color: '${styles.null}' },`);
146 if (styles.atom) data.push(`{ tag: t.atom, color: '${styles.atom}' },`);
147 if (styles.unit) data.push(`{ tag: t.unit, color: '${styles.unit}' },`);
148 if (styles.modifier) data.push(`{ tag: t.modifier, color: '${styles.modifier}' },`);
149 if (styles.operatorKeyword) data.push(`{ tag: t.operatorKeyword, color: '${styles.operatorKeyword}' },`);
150 if (styles.controlKeyword) data.push(`{ tag: t.controlKeyword, color: '${styles.controlKeyword}' },`);
151 if (styles.definitionKeyword) data.push(`{ tag: t.definitionKeyword, color: '${styles.definitionKeyword}' },`);
152 if (styles.moduleKeyword) data.push(`{ tag: t.moduleKeyword, color: '${styles.moduleKeyword}' },`);
153 if (styles.operator) data.push(`{ tag: t.operator, color: '${styles.operator}' },`);
154 if (styles.derefOperator) data.push(`{ tag: t.derefOperator, color: '${styles.derefOperator}' },`);
155 if (styles.arithmeticOperator) data.push(`{ tag: t.arithmeticOperator, color: '${styles.arithmeticOperator}' },`);
156 if (styles.logicOperator) data.push(`{ tag: t.logicOperator, color: '${styles.logicOperator}' },`);

Callers 3

handleChangeFunction · 0.90
SampleCodeFunction · 0.90
ThemeEditorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…