Skip to main content
Version: 1.0.3

Components API Reference

ThemeProvider

The root provider component that powers the theming system. Must wrap your application.

Import

import { ThemeProvider } from '@mindfiredigital/ignix-ui';

Props

PropTypeDefaultDescription
childrenReact.ReactNode-Your application's components
defaultThemeIdstring'ignix-light'Initial theme if none is found in storage
persistKeystring'ignix-theme'localStorage key for theme persistence
onThemeChange(theme: ThemeConfig) => void-Callback when theme changes
enableSystemPreferencebooleantrueRespect OS color scheme preference

Example

function App() {
return (
<ThemeProvider defaultThemeId="cyberpunk-neon">
<YourApp />
</ThemeProvider>
);
}

ThemeSwitcher

A component that allows users to browse and select themes.

Import

import { ThemeSwitcher } from '@mindfiredigital/ignix-ui';

Props

PropTypeDefaultDescription
layout'dropdown' | 'grid' | 'list''dropdown'Visual layout type
showPreviewbooleantrueShow color swatches
showCategoriesbooleantrueGroup themes by category
showModeTogglebooleantrueShow light/dark toggle
classNamestring-Additional CSS class
onThemeSelect(theme: ThemeConfig) => void-Theme selection callback

Example

<ThemeSwitcher 
layout="grid"
onThemeSelect={(theme) => console.log('Selected:', theme.id)}
/>

ThemeEngine

The core engine that powers the Ignix UI theming system. Provides methods for creating, validating, and converting themes.

Import

import { ThemeEngine } from '@mindfiredigital/ignix-ui';

ThemeEngine.createTheme(input: CreateThemeInput)

Creates a new theme with automatic color generation and dark mode support.

Parameters

ParameterTypeDescription
inputCreateThemeInputConfiguration object for the theme

Example

const theme = ThemeEngine.createTheme({
id: 'ocean-theme',
name: 'Ocean Theme',
category: 'brand',
primary: '#2563EB',
secondary: '#14B8A6',
accent: '#F59E0B',
description: 'A cool, ocean-inspired color palette',
generateDark: true,
contrastLevel: 'AA',
mode: 'light', // defaults to 'light'
});

ThemeEngine.validateAndFix(theme: ThemeConfig, level: ContrastLevel)

Validates a theme against accessibility standards and attempts to fix any issues.

Parameters

ParameterTypeDescription
themeThemeConfigThe theme to validate
level`'AA''AAA'`

Returns

{
theme: ThemeConfig; // The fixed theme (if changes were made)
validation: {
isValid: boolean; // Whether the theme passes validation
errors: string[]; // Array of error messages
warnings: string[]; // Array of warning messages
score: number; // Overall accessibility score (0-100)
}
}

Example

const { theme: fixedTheme, validation } = ThemeEngine.validateAndFix(theme, 'AA');
console.log(validation.isValid); // true
console.log(validation.errors); // []
console.log(validation.score); // 100

ThemeEngine.toCss(theme: ThemeConfig)

Generates CSS custom properties from a theme.

Parameters

ParameterTypeDescription
themeThemeConfigThe theme to convert to CSS

Returns

A string containing CSS custom properties for both light and dark modes.

Example

const css = ThemeEngine.toCss(theme);
// Returns CSS with :root and .dark selectors

ColorUtils

Utility class for color manipulation and contrast checking.

Import

import { ColorUtils } from '@mindfiredigital/ignix-ui';

Methods

Color Conversion

// Convert between color formats
const hsl = ColorUtils.hexToHsl('#2563EB');
const hex = ColorUtils.hslToHex(210, 83, 57);

Color Adjustments

// Adjust color properties
const lighter = ColorUtils.adjustLightness('#2563EB', 10);
const moreSaturated = ColorUtils.adjustSaturation('#2563EB', 20);
const shiftedHue = ColorUtils.adjustHue('#2563EB', 30);

Color Relationships

// Get color relationships
const complementary = ColorUtils.getComplementary('#2563EB');
const [analogous1, analogous2] = ColorUtils.getAnalogous('#2563EB');
const [triadic1, triadic2] = ColorUtils.getTriadic('#2563EB');

Contrast Checking

// Check contrast ratios
const ratio = ColorUtils.getContrastRatio('#FFFFFF', '#000000');
const isAccessible = ColorUtils.isAccessible('#FFFFFF', '#000000', 'AA');

Next