Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:A9T9 RPA OcrMatchesHighlighter

From Leeroopedia
Knowledge Sources
Domains OCR, Visual_Feedback
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete tool for drawing colored overlay highlights over OCR-matched text on the page, provided by the Ui.Vision OCR highlighter.

Description

The OcrMatchesHighlighter class (`src/services/ocr/highlighter.ts`) renders visual feedback overlays on top of the page when an OCR search matches text. It draws colored rectangles over each matched word's bounding box, color-coded by match type (full match, prefix, partial, etc.). The `styleByType` function maps a match type string to CSS properties for the overlay.

The highlighter provides `update(match)` to draw highlights for a new match and `clear()` to remove all overlays. This gives the user immediate visual confirmation of where the OCR engine found the target text before a click or verification action is taken.

Usage

Use the highlighter during OCR-based automation to visually mark matched text on the page for user feedback. It is called by the OCR command execution pipeline after `searchTextInOCRResponse` finds a match.

Code Reference

Source Location

  • Repository: A9T9/RPA
  • File: src/services/ocr/highlighter.ts
  • Lines: L1-L18 (styleByType), L19-L661 (OcrMatchesHighlighter class)

Signature

export function styleByType(type: string): CSSProperties

export class OcrMatchesHighlighter {
  update(match: OcrTextSearchMatch): void
  clear(): void
}

Import

import { OcrMatchesHighlighter, styleByType } from '@/services/ocr/highlighter'

I/O Contract

Inputs

Name Type Required Description
match OcrTextSearchMatch Yes Matched text with word bounding boxes and match type

Outputs

Name Type Description
overlay DOM elements Colored overlay elements drawn over matched words on the page

Usage Examples

Highlight an OCR Match

import { OcrMatchesHighlighter } from '@/services/ocr/highlighter'

const highlighter = new OcrMatchesHighlighter()

// After searchTextInOCRResponse finds a match:
highlighter.update(result.hit)

// Clear highlights when done:
highlighter.clear()

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment