Skip to main content

Documentation Index

Fetch the complete documentation index at: https://copylabs.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Colors

Radix Themes Native provides a comprehensive color system with carefully designed color scales for both light and dark modes.

Color Scale Structure

Each color has a 12-step scale designed for different purposes:
StepPurpose
1App background
2Subtle background
3UI element background
4Hovered UI element background
5Active / Selected UI element background
6Subtle borders
7UI element border, focus ring
8Hovered UI element border
9Solid backgrounds
10Hovered solid backgrounds
11Low-contrast text
12High-contrast text

Using Colors

In Components

Most components accept a color prop:
<Button color="blue">Blue Button</Button>
<Badge color="green">Success</Badge>
<Callout color="red">Error message</Callout>

In Custom Styles

Access colors through the theme object:
import { useTheme, useThemeMode } from 'radix-native-ui';

function CustomComponent() {
  const theme = useTheme();
  const mode = useThemeMode();

  // Get the blue color scale
  const blueScale = mode === 'dark'
    ? theme.colors.blue.dark
    : theme.colors.blue;

  return (
    <View style={{
      backgroundColor: blueScale[3],
      borderColor: blueScale[6]
    }}>
      <Text style={{ color: blueScale[11] }}>
        Custom styled component
      </Text>
    </View>
  );
}

Available Colors

Accent Colors

amber - Warm yellow-orange

black - Pure black

blue - Classic blue

bronze - Metallic brown

brown - Earth brown

crimson - Deep red

cyan - Light blue-green

gold - Rich golden

grass - Natural green

green - Standard green

indigo - Purple-blue

iris - Light purple

jade - Cool green

lime - Bright green

mint - Soft green

orange - Vibrant orange

pink - Light red

plum - Deep purple

purple - Standard purple

red - Standard red

ruby - Jewel red

sky - Light blue

teal - Blue-green

tomato - Red-orange

violet - Blue-purple

white - Pure white

yellow - Bright yellow

Gray Scales

ScaleDescriptionBest For
grayStandard neutral grayGeneral purpose
mauveWarm gray with purple tintWarm color schemes
oliveGreen-tinted grayNatural/organic themes
sageSoft green-tinted grayCalm, natural themes
sandWarm beige-tinted grayWarm, earthy themes
slateCool blue-tinted grayCool, modern themes

Alpha Colors

For transparent overlays, use the alpha color scales:
import { useTheme, useThemeMode } from 'radix-native-ui';

function Overlay() {
  const theme = useTheme();
  const mode = useThemeMode();

  // Use blackAlpha for light mode, whiteAlpha for dark mode
  const alphaScale = mode === 'dark'
    ? theme.colors.whiteAlpha
    : theme.colors.blackAlpha;

  return (
    <View style={{
      backgroundColor: alphaScale[3] // 8% opacity
    }}>
      <Text>Overlay content</Text>
    </View>
  );
}

Alpha Scale Values

StepOpacity
14%
26%
38%
412%
516%
624%
736%
848%
964%
1080%
1192%
12100%

High Contrast Mode

Many components support a highContrast prop for improved visibility:
<Button highContrast>High Contrast Button</Button>
<Badge highContrast color="blue">Badge</Badge>
High contrast mode uses:
  • Background: Color step 11 (instead of 9)
  • Text: Black/white (depending on mode)

Color Helper Functions

getVariantColors

Get colors for a specific variant:
import { getVariantColors, useTheme, useThemeMode } from 'radix-native-ui';

function CustomButton({ variant = 'solid', highContrast = false }) {
  const theme = useTheme();
  const mode = useThemeMode();

  const colors = getVariantColors(
    theme,
    'blue',      // color name
    mode,
    variant,     // 'solid' | 'soft' | 'outline' | 'ghost'
    highContrast
  );

  // Returns: { backgroundColor, textColor, borderColor }
}

getColorScale

Get the full color scale:
import { getColorScale, useTheme, useThemeMode } from 'radix-native-ui';

function Component() {
  const theme = useTheme();
  const mode = useThemeMode();

  const blueScale = getColorScale(theme, 'blue', mode);
  // Returns color scale with steps 1-12
}

needsDarkText

Check if a color needs dark text (for light backgrounds):
import { needsDarkText } from 'radix-native-ui';

function Component() {
  // Returns true for colors like sky, mint, lime, yellow, amber
  const needsDark = needsDarkText('yellow');
}

getForegroundColor

Get the appropriate text color for a given background:
import { getForegroundColor, useTheme, useThemeMode } from 'radix-native-ui';

function Component() {
  const theme = useTheme();
  const mode = useThemeMode();

  const textColor = getForegroundColor(theme, 'blue', mode, false);
  // Returns the appropriate text color for the background
}

Best Practices

  1. Use appropriate colors - Use green for success states, red for errors, amber for warnings
  2. Maintain contrast - Ensure text has sufficient contrast against backgrounds
  3. Use highContrast - Enable for accessibility when needed
  4. Test both modes - Always test your UI in both light and dark modes