forked from mirrors/misskey
Update theme.ts
This commit is contained in:
parent
f69b3b8d91
commit
98d362df23
1 changed files with 5 additions and 5 deletions
|
|
@ -29,7 +29,7 @@ export type Theme = {
|
|||
|
||||
export type CompiledTheme = Record<string, string>;
|
||||
|
||||
const MAX_THEME_REFERENCE_DEPTH = 4;
|
||||
const MAX_THEME_REFERENCE_DEPTH = 8;
|
||||
|
||||
export const themeProps = Object.keys(lightTheme.props).filter(key => !key.startsWith('X'));
|
||||
|
||||
|
|
@ -76,15 +76,15 @@ function getThemeReferenceColor(theme: Theme, key: string, stack: string[], dept
|
|||
}
|
||||
|
||||
function getColor(theme: Theme, val: string, stack: string[] = [], depth = 0): tinycolor.Instance {
|
||||
if (depth >= MAX_THEME_REFERENCE_DEPTH) {
|
||||
throw new Error('Theme reference limit exceeded');
|
||||
}
|
||||
|
||||
if (val[0] === '@') { // ref (prop)
|
||||
return getThemeReferenceColor(theme, val.substring(1), stack, depth);
|
||||
} else if (val[0] === '$') { // ref (const)
|
||||
return getThemeReferenceColor(theme, val, stack, depth);
|
||||
} else if (val[0] === ':') { // func
|
||||
if (depth >= MAX_THEME_REFERENCE_DEPTH) {
|
||||
throw new Error('Theme reference limit exceeded');
|
||||
}
|
||||
|
||||
const parts = val.split('<');
|
||||
const funcTxt = parts.shift();
|
||||
const argTxt = parts.shift();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue