MCPcopy Index your code
hub / github.com/darkreader/darkreader / inspectVariable

Method inspectVariable

src/inject/dynamic-theme/variables.ts:457–484  ·  view source on GitHub ↗
(varName: string, value: string)

Source from the content-addressed store, hash-verified

455 }
456
457 private inspectVariable(varName: string, value: string) {
458 this.unstableVarValues.set(varName, value);
459
460 if (isVarDependant(value) && isConstructedColorVar(value)) {
461 this.unknownColorVars.add(varName);
462 this.definedVars.add(varName);
463 }
464 if (this.definedVars.has(varName)) {
465 return;
466 }
467 this.definedVars.add(varName);
468
469 // Check if the value is either a raw value or a value that can be parsed
470 // e.g. rgb, hsl.
471 const isColor = Boolean(
472 getRGBValues(value) ||
473 parseColorWithCache(value)
474 );
475 if (isColor) {
476 this.unknownColorVars.add(varName);
477 } else if (
478 value.includes('url(') ||
479 value.includes('linear-gradient(') ||
480 value.includes('radial-gradient(')
481 ) {
482 this.resolveVariableType(varName, VAR_TYPE_BG_IMG);
483 }
484 }
485
486 private resolveVariableType(varName: string, typeNum: number) {
487 const initialType = this.initialVarTypes.get(varName) || 0;

Callers 2

collectRootVariablesMethod · 0.95

Calls 8

resolveVariableTypeMethod · 0.95
getRGBValuesFunction · 0.90
parseColorWithCacheFunction · 0.90
isVarDependantFunction · 0.85
isConstructedColorVarFunction · 0.85
addMethod · 0.80
setMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected