Documentation
¶
Overview ¶
Package logotile decides which tile background a channel logo stays legible on. The console draws a live TV logo on a white or a dark (zinc-900) tile; ink that lands close to the tile colour disappears.
The scorer samples the image into a 64x64 RGBA grid, composites every transparent sample over each candidate tile, and sums the alpha-weighted contrast deficit:
cost(tile) = Σ alpha · max(0, MinContrast − contrast(ink, tile))
A large rectangular plate with contrasting internal lettering can dominate that sum. When separate ink accompanies such a plate, score that ink instead.
Index ¶
Constants ¶
const Header = "X-Ether-Logo-Background"
Header carries the decision to the console on the logo response.
const MinContrast = 2.5
MinContrast is the contrast ratio below which ink dissolves into the tile. WCAG 1.4.11 asks graphical objects for 3:1; 2.5 sits just below that, so only ink that is already fading counts as lost.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Background ¶
type Background string
Background is the tile colour a logo should be drawn on.
const ( // Light is the white tile. Light Background = "light" // Dark is the zinc-900 tile, and the default for unreadable images. Dark Background = "dark" )
type Evidence ¶
type Evidence struct {
Background Background
// Ink is the alpha-weighted visible area in sampled pixels (0..4096).
Ink float64
// LightCost and DarkCost are the scored contrast deficits; lower wins.
LightCost float64
DarkCost float64
}
Evidence is a decision plus the numbers behind it, so callers and tests can explain a choice instead of re-deriving it.
func DecideBytes ¶
DecideBytes decodes an encoded image (PNG, JPEG, GIF or WebP) and decides.