implemented custom theme system#687
Open
adeboladee wants to merge 1 commit into
Open
Conversation
|
Hey @adeboladee! 👋 It looks like this PR isn't linked to any issue. If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g.,
|
|
@adeboladee Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #379
PR Summary: Subscription Custom Theme System
Key Features
ThemeConfigwith brand colors (primary, secondary, accent + semantic colors),FontConfig(family, weights, sizes), andLogoConfig(URI, darkURI, dimensions).startPreview→updatePreview→applyPreview/discardPreview.--st-{name}variables with auto-rgbvariants,--st-ext-{name}for extended colors, font/logo variables, and full:rootstylesheet generation.getAccessibilityRating(), providing fix suggestions for non-compliant color pairs.ThemeVariantPairsystem links light and dark themes together under a sharedThemeSharedConfigfeaturing fonts and logos.inheritTheme()allows the creation of child themes from a parent with partial overrides.ThemeExportDataformat (v1.0.0) for sharing themes across merchants.New Files Created
src/theme/customThemeBuilder.tssrc/theme/cssVariables.tssrc/theme/accessibility.tsrelativeLuminance,contrastRatio,meetsWcagAA/AAA),getAccessibilityRating()for a full theme audit, andsuggestContrastFix()for auto-correction.src/theme/themeService.tsAsyncStoragepersistence andsaveThemeVariantPair().Modified Files
src/theme/types.tsExtendedThemeColors,FontConfig,LogoConfig,AccessibilityInfo,AccessibilityIssue,ThemeVariantPair,ThemeSharedConfig,ThemeConfig,ThemeExportData,ThemeInheritance, andThemePreviewState.src/theme/themes.tscreateBrandThemenow generatesextendedColors, setsisCustom, managescreatedAt/updatedAt, and exportshighContrastTheme.src/theme/themeStore.tsupdateCustomTheme(),addThemeVariantPair(),removeThemeVariantPair(),exportTheme(),importTheme(),syncToApi(),syncFromApi(), WCAG accessibility rating audits,getThemeById(), andgetVariantPair().src/theme/index.tssrc/store/index.tsuseThemeStoreexport.backend/subscription/router/index.tscreateThemeRouterexport.backend/server/createApiServer.ts/api/v1/merchant.backend/subscription/router/themeRouter.ts/api/v1/merchant.backend/migrations/004_theme_storage.sqlmerchant_themesandtheme_variant_pairstables with JSONB config, alongside triggers for single-active-theme enforcement.Test Results
83 tests passing across 6 test suites:
themes.test.ts(6 tests): VerifieshighContrastTheme,extendedColors,isCustom, and timestamps.customThemeBuilder.test.ts(21 tests): Covers color utilities, theme construction, variant pairs, and inheritance.cssVariables.test.ts(12 tests): Covers variable flattening, camelCase → kebab-case conversion, prefix handling, and stylesheet generation.accessibility.test.ts(20 tests): Covers luminance, contrast ratios, WCAG AA/AAA checks, theme ratings, and fix suggestions.themeStore.test.ts(16 tests): Expanded from 9 → 16 tests covering previews, variants, export/import, and inheritance.themeService.test.ts(7 tests): Covers CRUD, export/import, and sync capabilities.