private Color getOperandColor(int opIndex) {

		Program program = currentCodeUnit.getProgram();

		// rely on primary reference if available as this should be the basis of 
		// the formatted operand representation.
		Reference ref = currentCodeUnit.getPrimaryReference(opIndex);
		Address refAddr = ref != null ? ref.getToAddress() : currentCodeUnit.getAddress(opIndex);

		if (refAddr == null) {
			return DEFAULT_FG_COLOR;
		}

		if (refAddr.isMemoryAddress() && !program.getMemory().contains(refAddr)) {
			return NOT_IN_MEMORY_COLOR;
		}

		SymbolTable st = program.getSymbolTable();
		Symbol sym = st.getSymbol(ref);
		if (sym != null) {
			return symbolInspector.getColor(sym);
		}

		return DEFAULT_FG_COLOR;
	}
Determine the color to use to render the specified operand
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/InstructionPanel.java