Skip to content

Themes & appearance ​

A chart often needs to match the rest of an app: its background, rising and falling colors, typography and labels. Start with theme to set the shared colors. Use appearance when one part of the chart needs a different treatment, such as a larger price label or a rounded tooltip.

For example, a light screen can set a white background and dark axis text in theme, then give the tooltip a border through appearance.tooltip. An explicit appearance value overrides the corresponding theme color; other parts keep their theme defaults.

Colors use #RRGGBB or #RRGGBBAA, where the final two digits set alpha. The tables below list the shared colors and the parts you can style separately.

Theme ​

These colors act as shared defaults. Set the few that need to match your app; omitted values keep the defaults below.

PropertyType / valuesDefaultDescription
backgroundColorColor#100C18Chart background.
gridColorColor#292431Grid fallback.
axisTextColorColor#9791A5Axis, extrema, and some additional-series fallback text/color.
upColorColor#38D98ARising-series fallback.
downColorColor#FF3B64Falling-series fallback.
crosshairColorColor#A8A2B3Crosshair line and badge fallback.
tooltipBackgroundColorColor#1B1723Tooltip background fallback.
tooltipTextColorColor#F5F2FATooltip text fallback.

Appearance groups ​

Each group controls one part of the chart. For example, candles sets body colors and corner radius, while tooltip controls its panel and text.

PropertyType / valuesDefaultDescription
backgroundColorColortheme.backgroundColorRole-specific background override.
grid.colorColortheme.gridColorGrid color.
grid.opacityNumber from 0 to 10.75Grid alpha multiplier.
candles.upColor / downColorColorTheme direction colorsCandlestick colors and bar fallbacks.
candles.radiusNon-negative number0Candlestick body corner radius.
bars.*Bar appearanceCandle colors, width 1OHLC bar presentation.
line.*Line appearanceTheme up color, width 1.5Main line presentation.
area.*Area appearanceTheme up color, width 1.5Main area outline and fill.
xAxis.text / yAxis.textChartTextStyletheme.axisTextColorNative axis text styles.
priceExtremes.*Text and colorsAxis/background colorsVisible high/low label presentation.
currentPrice.*Line and directional badgeActive-series colorsLatest-price presentation.
crosshair.*Line and badgestheme.crosshairColorSelection line and axis badges.
tooltip.*Text, colors, opacity, borderTooltip theme colorsOHLCV tooltip presentation.

Text, badge, and border properties ​

PropertyType / valuesDefaultDescription
text.colorColorRole fallbackText color.
text.fontFamilyNon-empty stringPlatform monospaceFont already bundled by the consuming application.
text.fontSizePositive numberNative role defaultPoints on iOS and scaled pixels on Android.
text.fontWeight'regular', 'medium', 'semibold', 'bold'Native role defaultRequested font weight.
badge.backgroundColorColorRole fallbackNon-directional badge background.
badge.upBackgroundColorColorActive up colorCurrent-price badge background for rising candles.
badge.downBackgroundColorColorActive down colorCurrent-price badge background for falling candles.
badge.textChartTextStyleRole fallbackBadge text style.
badge.borderChartBorderStyleTransparent, width 0Badge border.
border.colorColor#00000000Border color.
border.widthNon-negative number0Border width.
border.radiusNon-negative number4 for badges, 8 for tooltipCorner radius.

Overlay appearance properties ​

PropertyType / valuesDefaultDescription
priceExtremes.textChartTextStyleAxis text styleHigh/low text.
priceExtremes.connectorColorColorAxis text colorConnector line.
priceExtremes.backgroundColorColorChart backgroundLabel backing color.
currentPrice.line.upColor / downColorColorActive-series colorsCurrent-price line colors.
currentPrice.labelChartDirectionalBadgeStyleActive-series backgroundsCurrent-price badge.
priceLines.label.border.radiusNon-negative number0Corner radius of custom price-line axis badges.
crosshair.line.colorColortheme.crosshairColorCrosshair line color.
crosshair.line.opacityNumber from 0 to 10.85Crosshair line opacity.
crosshair.priceLabel / timeLabelChartBadgeStyleCrosshair-colored backgroundCrosshair axis badges.
tooltip.backgroundColorColortheme.tooltipBackgroundColorTooltip panel color.
tooltip.backgroundOpacityNumber from 0 to 1crosshair.tooltipBackgroundOpacityTooltip panel opacity.
tooltip.headerText / labelText / valueTextChartTextStyletheme.tooltipTextColorTooltip typography.
tooltip.positiveValueColor / negativeValueColorColorActive-series colorsDirectional value colors.
tooltip.borderChartBorderStyleTransparent, width 0, radius 8Tooltip border.

Axis regions do not automatically grow for larger fonts. Increase xAxis.height or yAxis.width when a custom style needs more space.

Light theme example ​

A candlestick chart using a light background, dark axis labels and green and red candles.

Explicit appearance values override the related theme fallbacks. Additional line/area series can also set their own appearance on the series options.

tsx
import { useEffect } from 'react';
import {
  TradingCharts,
  TradingChartsView,
  type OhlcCandle,
} from 'react-native-trading-charts';

// Deterministic sample data. Replace this with your market-data feed.
const history: OhlcCandle[] = Array.from({ length: 80 }, (_, index) => {
  const open = 100 + Math.sin(index / 5) * 8;
  const close = 100 + Math.sin((index + 1) / 5) * 8;
  return {
    timestamp: 1_720_000_000_000 + index * 60_000,
    open,
    high: Math.max(open, close) + 2,
    low: Math.min(open, close) - 2,
    close,
    volume: 10 + index,
  };
});

const chartId = 'styling';

export function Example() {
  useEffect(() => {
    TradingCharts.setHistory(chartId, history);
  }, []);

  return (
    <TradingChartsView
      style={{ height: 420 }}
      chartId={chartId}
      theme={{
        backgroundColor: '#FFFFFF',
        gridColor: '#E2E8F0',
        axisTextColor: '#475569',
        upColor: '#009E73',
        downColor: '#E64966',
        crosshairColor: '#64748B',
        tooltipBackgroundColor: '#FFFFFF',
        tooltipTextColor: '#0F172A',
      }}
      appearance={{
        candles: { radius: 2 },
        grid: { opacity: 0.5 },
        yAxis: { text: { fontSize: 12, fontWeight: 'medium' } },
        tooltip: { border: { color: '#CBD5E1', width: 1, radius: 10 } },
        crosshair: { priceLabel: { text: { color: '#FFFFFF' } } },
      }}
      yAxis={{ width: 80 }}
    />
  );
}

Released under the MIT License.