-
Notifications
You must be signed in to change notification settings - Fork 0
Project Structure
Mirabelle Doiron edited this page Mar 29, 2026
·
1 revision
colorx/
packages/
core/ # Standalone TS library (@colorx/core)
src/
types.ts # ThemeColors, ContrastResult, ThemeOutput, APCAResult, CVDType
color-math.ts # Color conversion: hex, RGB, HSL
contrast.ts # WCAG 2.1 contrast ratio + enforcement
apca.ts # APCA Lc contrast algorithm (WCAG 3.0 draft)
cvd.ts # Color vision deficiency simulation (Brettel/Vienot matrices)
theme.ts # Light/dark theme generation + audit
css.ts # CSS custom properties output
index.ts # Barrel export
tests/ # 42 tests across 5 suites
apps/
web/ # React SPA (@colorx/web)
src/
components/
ui/ # shadcn/ui (Button, Card, Badge, Tabs, Table, Separator, Tooltip)
layout/ # RootLayout, Nav, Footer, SkipLink
primitives/ # Container, Stack, Grid, Flex
color-input/ # ColorPicker, ColorForm
theme-display/ # ThemeTabs, SwatchGrid, Swatch, UIPreview
contrast/ # ContrastAudit, ContrastBadge, APCABadge
cvd/ # CVDSimulation, CVDPreview
output/ # CSSOutput, CopyButton
landing/ # Hero, DemoPreview, HowItWorks, Features, WCAGExplainer, TokenReference, CTABottom
common/ # AnimateIn, ErrorBoundary, LowCarbonImage, VisuallyHidden
hooks/
useDocumentTitle.ts # Per-page document title
usePreferences.ts # Dark/a11y/low-carbon state (useSyncExternalStore)
useTheme.ts # ThemeContext consumer
useAPCA.ts # APCA audit for theme pairs
useCVD.ts # CVD simulation for themes
useCopyToClipboard.ts # Clipboard API + SR announcement
useReducedMotion.ts # prefers-reduced-motion
useAnnounce.ts # aria-live announcements
context/
ThemeContext.tsx # Hex input + generated ThemeOutput
AnnounceContext.tsx # Screen reader announcement provider
pages/
LandingPage.tsx
GeneratorPage.tsx
NotFoundPage.tsx-
pnpm workspaces with
packages/*andapps/* -
@colorx/corereferenced viaworkspace:*protocol - Vite resolves
@colorx/coreto source during dev (no build step needed) -
@/alias maps toapps/web/src/for clean imports
Custom polymorphic components in layout/primitives/:
| Component | Purpose | Props |
|---|---|---|
Container |
Centered max-width wrapper |
as, size (sm/md/lg/xl) |
Stack |
Vertical flex layout |
as, gap
|
Grid |
Responsive CSS grid |
as, cols (1-4), gap
|
Flex |
Horizontal flex layout |
as, gap, align, justify, wrap, direction
|
All support polymorphic as prop for semantic HTML (section, nav, ul, ol, li, article, header, footer).