Design System (CoUI)#
Triggers#
- When defining or modifying new design tokens (colors, typography, spacing, motion)
- When customizing CoUI themes
- When configuring or changing CoUI component themes
- When creating or updating design system documentation
- When switching between or comparing 3 design systems (CoUI, M3 Expressive, Liquid Glass)
Actions#
- Analyze existing design token files in the
coui_corepackage - Review theme configuration based on
CoreThemeData - Create or modify design tokens according to requested changes
-
Verify consistency between Flutter-side
coui_flutterand Jaspr Web-sidecoui_web - Confirm that themes are correctly applied to CoUI components
coui_core Design Token Reference#
CoreThemeData (Top-level Theme Object)#
import 'package:coui_core/coui_core.dart';
final theme = CoreThemeData(
colorScheme: CoreColorScheme(...), // Required â 36 color tokens
brightness: CoreBrightness.light, // Required â light | dark
designSystem: DesignSystem.coui, // Required â coui | m3Expressive | liquidGlass
typography: CoreTypographyScale.material3, // Optional â 30 text styles
cornerStyle: CornerStyle.rounded, // Optional â rounded | squircle | glassRounded
defaultMotion: CoreSpringConfig.standard, // Optional â animation default
defaultSurface: CoreSurfaceToken.flat(), // Optional â surface rendering
textScaling: 1.0, // Optional â global text scale
sizeScaling: 1.0, // Optional â global size scale
radiusScaling: 1.0, // Optional â global radius scale
);
CoreColorScheme (36 Color Tokens)#
CoUI Core (20, required):
primary,primaryContentsecondary,secondaryContentaccent,accentContentneutral,neutralContentbase100,base200,base300,baseContentinfo,infoContentsuccess,successContentwarning,warningContenterror,errorContent
M3 Expressive Extended (12, nullable):
tertiary,tertiaryContent-
surfaceContainerLowest,surfaceContainerLow,surfaceContainer,surfaceContainerHigh,surfaceContainerHighest outline,outlineVariantinverseSurface,inverseOnSurface,inversePrimary
Liquid Glass (4, nullable):
-
glassTint,glassHighlight,glassShadow,glassIllumination
final scheme = CoreColorScheme(
primary: CoreColor.fromHex('#570DF8'),
primaryContent: CoreColor.fromHex('#FFFFFF'),
// ... 20 required tokens
);
// Or create from a Map
final scheme = CoreColorScheme.fromMap(colorMap);
CoreTypographyScale (30 Text Styles)#
Baseline (15): displayLarge/Medium/Small, headlineLarge/Medium/Small, titleLarge/Medium/Small, bodyLarge/Medium/Small, labelLarge/Medium/Small
Emphasized (15): Each baseline with Emphasized suffix (heavier font-weight)
final typography = CoreTypographyScale.material3;
final headline = typography.headlineLarge;
// â CoreTextStyle(fontSize: 32, lineHeight: 1.25, fontWeight: 400)
final scaled = typography.scale(0.875); // Overall scale
Spacing (34 Values)#
// Spacing.s0 (0) ~ Spacing.s96 (384)
// Key values: s1(4), s2(8), s3(12), s4(16), s6(24), s8(32), s12(48), s16(64)
CoreRadiusScale (10 Steps + 4 Semantic Aliases)#
// Scale: none(0), extraExtraSmall(2), extraSmall(4), small(8), medium(12),
// large(16), extraLarge(20), extraExtraLarge(28), extraExtraExtraLarge(32), full(9999)
// Semantic: box(16), field(4), selector(8), badge(9999)
CoreComponentSize#
enum CoreComponentSize { xs, sm, md, lg, xl }
CoreDuration (12 Timing Values)#
// instant(0ms), ultraShort(50ms), xs(100ms), short(150ms),
// normal(200ms), medium(300ms), long(400ms), xl(500ms)
// Semantic: pageTransition, modal(250ms), tooltipDelay, toast(3000ms)
CoreSpringConfig (5 Presets)#
// gentle(damping:0.8, stiffness:200), standard(0.7, 300),
// bouncy(0.5, 400), snappy(0.9, 500), stiff(1.0, 600)
CoreMotionToken (sealed class)#
// CssTransitionMotion â CSS transition based (durationMs + easing)
// SpringMotion â Spring physics based (dampingRatio + stiffness)
// GlassPhysicsMotion â Liquid Glass physics (spring + specularResponse)
CoreSurfaceToken (Surface Rendering)#
CoreSurfaceToken.flat() // Flat
CoreSurfaceToken.tonalElevation(elevation: 2) // M3 tonal elevation (0-5)
CoreSurfaceToken.glass(opacity: 0.3, blur: 20, material: CoreGlassMaterial(...)) // Glass
DesignSystem enum#
enum DesignSystem { coui, m3Expressive, liquidGlass }
| Dimension | CoUI | M3 Expressive | Liquid Glass |
|---|---|---|---|
| Color | 20 semantic tokens | +12 surface/outline | +4 glass tokens |
| Shape | rounded | squircle | glassRounded |
| Motion | CSS transition | Spring physics | Glass physics |
| Surface | flat | tonalElevation | glass |
Output#
CoreThemeData-based theme configuration codeCoreColorSchemedefinitions (CoUI/M3E/LG layers)- CoUI CSS theme configuration
- Flutter/Web cross-platform consistency verification results
Notes#
-
CoUI consists of 3 packages:
coui_core(tokens + contracts),coui_flutter(Flutter implementation),coui_web(Jaspr Web implementation) coui_coredesign tokens are pure Dart objects shared across platforms- CoUI themes are applied via CSS on the Jaspr Web side and provide various built-in themes
- Flutter-side themes read tokens directly from
CoreThemeDataand apply them to widgets -
CoreColorScheme.fromMap()andtoMap()enable JSON serialization/deserialization - Use
CoreThemeData.copyWith()to create theme variants such as dark mode