Frodo Library - v4.8.5
    Preparing search index...

    Function matchBackgroundPreset

    • Matches a detected background RGB against a fixed set of named presets by simple RGB-space nearest-neighbor, falling back to fallbackDark/ fallbackLight (chosen by relative luminance) when nothing is close enough to be a confident match. maxDistance (0-441.7, the diagonal of the RGB cube) defaults to a fairly tight radius -- this is meant to catch "this terminal is unmistakably that preset's color", not to force every detected background into the nearest bucket regardless of how far off it actually is.

      Parameters

      • detectedRgb: Rgb
      • presets: BackgroundPreset[]
      • fallbackDark: string
      • fallbackLight: string
      • maxDistance: number = 60

      Returns string