Repository navigation
feat: forward appearance and setAppearance() to the SDK for dark mode - #59
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
pandeymangg
approved these changes
Oct 19, 2026
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.



What & why
Was:
@formbricks/jshad no way to turn on dark mode.setup({ appearance })dropped the field, andformbricks.setAppearancewasundefined, although the SDK the wrapper loads supports both since Formbricks 6.1 (formbricks/formbricks#9549).Now: both are forwarded and typed (
TAppearanceis exported), and the version is 5.2.0 so a release can go out with Formbricks 6.1. Custom CSS needs no wrapper change: it comes from the server.setAppearance()before the SDK script loads is applied right after load and beforesetup(), matching js-core, which applies appearance outside its queue. Queuing it behind setup would show a survey triggered during setup in light first.setAppearance()logs the existing "Method … does not exist" error, andappearanceinsetup()is ignored (6.0 only reads the fields it knows).Where to look
packages/js/src/lib/load-formbricks.ts:setAppearance,applyPendingAppearanceTo, andappearancepassthrough invalidateSetupArgspackages/js/src/types/formbricks.ts:TAppearance,setAppearance,TSetupConfig.appearanceCoverage
appearanceinsetup()reaches the SDKload-formbricks.test.ts› should forward appearance from the setup config to the SDK. Red without...appearanceArginvalidateSetupArgssetAppearanceruns before SDKsetup()applyPendingAppearanceTo(instance)callindex.test.ts› should delegate setAppearance to the loader's setAppearancesetAppearance("dark")before setup opens the survey dark;setAppearance("light")switches the open survey in place;setup({ appearance: "dark" })opens it darkRerun:
pnpm --filter @formbricks/js testOpen gaps
"system"not checked against a dark OS setting in a real browser.Affected packages:
packages/js(plus a "Dark mode" section in both READMEs).