private Highlight createHighlight(MemoryMatch match, Address start, String text, Color color) {
		int highlightLength = match.getLength();
		Address address = match.getAddress();
		int startByteOffset = (int) address.subtract(start);
		int endByteOffset = startByteOffset + highlightLength - 1;
		startByteOffset = Math.max(startByteOffset, 0);
		return getHighlight(text, startByteOffset, endByteOffset, color);
	}
Listing highlight provider to highlight memory search results.
Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemoryMatchHighlighter.java