MDK Logo

Constants

Shared constants for colors, units, and chart configurations

Constants

The @mdk/core package provides shared constants for consistent values across your application.

Import

import {
  COLOR,
  UNITS,
  CURRENCY,
  CHART_COLORS,
  TABLE_COLORS,
  HASHRATE_LABEL_DIVISOR,
} from '@mdk/core'

Color constants

COLOR

Comprehensive color palette with 80+ named colors.

import { COLOR } from '@mdk/core'

COLOR.GREEN        // '#72F59E'
COLOR.RED          // '#EF4444'
COLOR.COLD_ORANGE  // '#F7931A'

Base colors

ConstantValueDescription
WHITE#FFFFFFPure white
BLACK#17130FStandard black
DARK_BACK#1A1815Dark background
EBONY#0f0f0fChart background
TRANSPARENTtransparentTransparent

Status colors

ConstantValueDescription
GREEN#72F59ESuccess/online
RED#EF4444Error/danger
YELLOW#FFC107Warning
BRIGHT_YELLOW#EAB308Bright warning
LIGHT_BLUE#22AFFFInfo
SLEEP_BLUE#3B82F6Sleep/standby

Brand colors

ConstantValueDescription
COLD_ORANGE#F7931ABitcoin orange
ORANGE#FF6A00Primary orange
EMERALD#009393Teal accent
INDIGO#5B5FFBPurple accent

TABLE_COLORS

Colors for table styling.

import { TABLE_COLORS } from '@mdk/core'

TABLE_COLORS.HEADER_BG
TABLE_COLORS.ROW_HOVER

HEATMAP

Heatmap color scale for temperature/intensity displays.

import { HEATMAP } from '@mdk/core'

CHART_COLORS

Default chart color palette.

import { CHART_COLORS } from '@mdk/core'

PIE_CHART_COLORS

Color palette for pie/doughnut charts.

import { PIE_CHART_COLORS } from '@mdk/core'

CATEGORICAL_COLORS

25-color categorical palette for multi-series charts.

import { CATEGORICAL_COLORS } from '@mdk/core'

CATEGORICAL_COLORS[0]  // First color
CATEGORICAL_COLORS[24] // Last color

TEMPERATURE_COLORS

Color scale for temperature displays.

import { TEMPERATURE_COLORS } from '@mdk/core'

SOCKET_BORDER_COLOR

Colors for socket status indicators.

import { SOCKET_BORDER_COLOR } from '@mdk/core'

Unit constants

UNITS

Physical and measurement units.

import { UNITS } from '@mdk/core'

UNITS.POWER_W         // 'W'
UNITS.POWER_KW        // 'kW'
UNITS.ENERGY_MWH      // 'MWh'
UNITS.TEMPERATURE_C   // '°C'
UNITS.HASHRATE_TH_S   // 'TH/s'
ConstantValueDescription
POWER_WWWatts
POWER_KWkWKilowatts
ENERGY_WHWhWatt-hours
ENERGY_KWHkWhKilowatt-hours
ENERGY_MWMWMegawatts
ENERGY_MWHMWhMegawatt-hours
ENERGY_GWHGWhGigawatt-hours
TEMPERATURE_C°CCelsius
VOLTAGE_VVVolts
AMPEREAAmperes
PERCENT%Percentage
PRESSURE_BARbarPressure (bar)
HASHRATE_MH_SMH/sMegahash/second
HASHRATE_TH_STH/sTerahash/second
HASHRATE_PH_SPH/sPetahash/second
HASHRATE_EH_SEH/sExahash/second
FREQUENCY_MHZMHzMegahertz
FREQUENCY_HERTZHzHertz
HUMIDITY_PERCENT%RHRelative humidity
EFFICIENCY_W_PER_THW/THWatts per terahash
FLOW_M3Hm3/hFlow rate
SATSSatsSatoshis
VBYTEvByteVirtual bytes

CURRENCY

Currency symbols and labels.

import { CURRENCY } from '@mdk/core'

CURRENCY.BTC       // '₿'
CURRENCY.USD       // '$'
CURRENCY.EUR       // '€'
CURRENCY.SATS      // 'Sats'
CURRENCY.BTC_LABEL // 'BTC'
CURRENCY.USD_LABEL // 'USD'

MAX_UNIT_VALUE

Maximum values for certain units.

import { MAX_UNIT_VALUE } from '@mdk/core'

MAX_UNIT_VALUE.HUMIDITY_PERCENT     // 100
MAX_UNIT_VALUE.TEMPERATURE_PERCENT  // 100

HASHRATE_LABEL_DIVISOR

Divisors for converting hashrate units.

import { HASHRATE_LABEL_DIVISOR } from '@mdk/core'

HASHRATE_LABEL_DIVISOR['TH/s']  // 1e6
HASHRATE_LABEL_DIVISOR['PH/s']  // 1e9
HASHRATE_LABEL_DIVISOR['EH/s']  // 1e12

Chart constants

defaultChartColors

Default color array for chart datasets.

import { defaultChartColors } from '@mdk/core'

// Array of colors for chart series

defaultChartOptions

Default Chart.js options.

import { defaultChartOptions } from '@mdk/core'

// Base options for all charts

CHART_LEGEND_OPACITY

Opacity values for chart legends.

import { CHART_LEGEND_OPACITY } from '@mdk/core'

CHART_PERFORMANCE

Performance threshold constants for charts.

import { CHART_PERFORMANCE } from '@mdk/core'

getChartAnimationConfig

Get animation configuration based on data count.

import { getChartAnimationConfig } from '@mdk/core'

const animConfig = getChartAnimationConfig(dataPointCount)

getDataDecimationConfig

Get data decimation configuration for large datasets.

import { getDataDecimationConfig } from '@mdk/core'

const decimationConfig = getDataDecimationConfig(dataPointCount)

Type exports

The constants module also exports TypeScript types:

import type {
  UnitKey,
  UnitValue,
  CurrencyKey,
  CurrencyValue,
} from '@mdk/core'

On this page