Minor Changes
This release introduces enhanced theme flexibility and significantly improved consent callbacks with structured data responses.
โจ New Features
Comprehensive Theming Support
useColorScheme
now detects themes via the.dark
class ondocument.documentElement
- Optional
colorScheme
parameter improves integration with existing theme systems - Full test suite added to validate dark/light/system theme switching
- Theme system now uses
@layer base
for better CSS encapsulation
Improved Consent Callbacks
- Callbacks now return structured and useful consent data
- Works consistently across offline, c15t, and backend-connected modes
- Callback responses now reflect user-selected preferences more clearly
๐ Bug Fixes
- #203 4d47e21 โ fix(core): callbacks not working in c15t mode. Thanks @KayleeWilliams!
- Fixed callbacks not firing in alternate modes (e.g., c15t)
useColorScheme
now correctly responds to:- System preference changes
- Document class changes (via MutationObserver)
- Improved error handling for environments missing
matchMedia
- Removed unnecessary localStorage dependency for theme persistence
๐๏ธ Refactors
- Theme-related CSS is now consistently structured using
@layer base
- Refined internal theme types to allow better extension/customization
- Simplified theme config to support nested object structure for banners and widgets
๐ Documentation
- Fixed broken example in offline mode โ #187
- Updated configuration types to document new theme and colorScheme options
- Added detailed callback payload examples and behavior notes across client modes
- Enhanced API references and docs for:
onSetConsent
and other lifecycle callbacks- Banner fetch event handler
๐งช Tests
Color Scheme Tests:
- System preference override
- Explicit theme override
- Document class detection
Callback Tests:
- Triggering across client modes
- Payload accuracy and structure
๐ฅ Breaking Changes
- Removed localStorage theme fallback โ rely on system preference or class
- Misconfigured theme props in c15t config may need to be adjusted
- Some fields (e.g.,
id
) removed from callback data objects โ now accessible via the response object
๐ Migration Guide
Theme System Changes
localStorage theme fallback has been removed:
Callback Data Structure
Some fields have been moved in callback responses:
๐ฆ Version Packages
Published via #205 by @github-actions
This release significantly enhances the theming capabilities and callback reliability of c15t, providing a more robust foundation for custom UI implementations and better integration with existing design systems.