GlucoseIQ
API Reference

Tokens API

Public zones, palettes, glyphs, brand values, and helpers exported by @glucoseiq/tokens.

@glucoseiq/tokens has one root entrypoint and no runtime dependencies. Its exports are presentation primitives; they do not replace configurable core analytics.

Zone model

ExportTypeContract
GlucoseZoneType'veryLow' | 'low' | 'inRange' | 'high' | 'veryHigh'
GLUCOSE_ZONESReadonly arrayAll five zones, ordered low to high
ZONE_THRESHOLDS_MGDLReadonly objectFixed consensus boundaries in mg/dL
classifyGlucoseZoneFunctionClassifies one positive finite mg/dL value

The threshold object contains veryLowMax: 54, lowMax: 70, inRangeMax: 180, and highMax: 250. The first two bounds are exclusive; the in-range and high maxima are inclusive. classifyGlucoseZone throws RangeError for zero, negative, non-finite, or NaN input.

Theme and color exports

ExportTypeContract
ThemeType'dark' | 'light'
ZONE_PALETTERecordOne hex color for every zone in both themes
zoneColorFunctionReturns one zone color; theme defaults to dark
BRANDReadonly objectblack, drop, surface, border, and muted colors
cssVariablesFunctionReturns CSS declarations; theme defaults to dark

cssVariables emits --giq-zone-*, --giq-bg, --giq-drop, --giq-surface, --giq-border, and --giq-muted declarations. It does not include a selector.

import {
  GLUCOSE_ZONES,
  classifyGlucoseZone,
  cssVariables,
  zoneColor,
  type Theme,
} from '@glucoseiq/tokens'

function legend(theme: Theme) {
  return GLUCOSE_ZONES.map((zone) => ({
    zone,
    color: zoneColor(zone, theme),
  }))
}

const currentZone = classifyGlucoseZone(112)
const lightLegend = legend('light')
const scopedRule = `.glucose-panel { ${cssVariables('dark')} }`
void { currentZone, lightLegend, scopedRule }

Trend exports

ExportTypeContract
TREND_GLYPHSReadonly objectGlyphs for the eight normalized trend states
TrendKeyTypeKeys of TREND_GLYPHS

The keys are rapidRising, rising, slightlyRising, flat, slightlyFalling, falling, rapidFalling, and unknown.

Always place a text label or another non-color cue beside a palette value or trend glyph. The package does not claim that color or a glyph alone satisfies an application's accessibility requirements.

On this page