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
| Constant | Value | Description |
|---|---|---|
WHITE | #FFFFFF | Pure white |
BLACK | #17130F | Standard black |
DARK_BACK | #1A1815 | Dark background |
EBONY | #0f0f0f | Chart background |
TRANSPARENT | transparent | Transparent |
Status colors
| Constant | Value | Description |
|---|---|---|
GREEN | #72F59E | Success/online |
RED | #EF4444 | Error/danger |
YELLOW | #FFC107 | Warning |
BRIGHT_YELLOW | #EAB308 | Bright warning |
LIGHT_BLUE | #22AFFF | Info |
SLEEP_BLUE | #3B82F6 | Sleep/standby |
Brand colors
| Constant | Value | Description |
|---|---|---|
COLD_ORANGE | #F7931A | Bitcoin orange |
ORANGE | #FF6A00 | Primary orange |
EMERALD | #009393 | Teal accent |
INDIGO | #5B5FFB | Purple accent |
TABLE_COLORS
Colors for table styling.
import { TABLE_COLORS } from '@mdk/core'
TABLE_COLORS.HEADER_BG
TABLE_COLORS.ROW_HOVERHEATMAP
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 colorTEMPERATURE_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'| Constant | Value | Description |
|---|---|---|
POWER_W | W | Watts |
POWER_KW | kW | Kilowatts |
ENERGY_WH | Wh | Watt-hours |
ENERGY_KWH | kWh | Kilowatt-hours |
ENERGY_MW | MW | Megawatts |
ENERGY_MWH | MWh | Megawatt-hours |
ENERGY_GWH | GWh | Gigawatt-hours |
TEMPERATURE_C | °C | Celsius |
VOLTAGE_V | V | Volts |
AMPERE | A | Amperes |
PERCENT | % | Percentage |
PRESSURE_BAR | bar | Pressure (bar) |
HASHRATE_MH_S | MH/s | Megahash/second |
HASHRATE_TH_S | TH/s | Terahash/second |
HASHRATE_PH_S | PH/s | Petahash/second |
HASHRATE_EH_S | EH/s | Exahash/second |
FREQUENCY_MHZ | MHz | Megahertz |
FREQUENCY_HERTZ | Hz | Hertz |
HUMIDITY_PERCENT | %RH | Relative humidity |
EFFICIENCY_W_PER_TH | W/TH | Watts per terahash |
FLOW_M3H | m3/h | Flow rate |
SATS | Sats | Satoshis |
VBYTE | vByte | Virtual 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 // 100HASHRATE_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'] // 1e12Chart constants
defaultChartColors
Default color array for chart datasets.
import { defaultChartColors } from '@mdk/core'
// Array of colors for chart seriesdefaultChartOptions
Default Chart.js options.
import { defaultChartOptions } from '@mdk/core'
// Base options for all chartsCHART_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'
