rank

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package rank implements the spec Section 5 post-processing steps: candidate ranking (SVG > large raster, signal rank, dimension sanity), color-aware perceptual dedupe, logo kind/theme classification, and color extraction (declared-over-derived, median-cut quantization for the derived palette).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractColors

func ExtractColors(declaredCandidates []signals.ColorCandidate, rankedLogos []signals.LogoCandidate) []model.ColorEntry

ExtractColors implements spec Section 2's ColorEntry ranking: declared (theme-color, manifest) scores higher than derived but both are reported; declared entries pass through as-is (deduped by hex+role), and a derived palette is computed from the best-ranked logo asset when one is available. For an SVG top logo, "median-cut quantization" (which needs raster pixel data - no rasterizer in scope, see the extractor's ambiguity notes) is substituted with the declared fill/ stroke hex colors parsed from the sanitized source.

func Rank

func Rank(candidates []signals.LogoCandidate) []model.LogoAsset

Rank is RankCandidates followed by kind/theme classification into the final brand.logos array shape.

func RankCandidates

func RankCandidates(candidates []signals.LogoCandidate) []signals.LogoCandidate

RankCandidates implements spec Section 5's post-processing: dimension- sanity filtering, color-aware dedupe, and candidate ranking (SVG > large raster, signal rank), returning the final ordered, deduped candidate list (best first, capped at maxLogos). Exposed separately from Rank so callers needing the raw bytes too (e.g. ExtractColors' derived-palette step) don't have to re-run dedupe themselves.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL