0

The documentation says that you can use multiple themes by just including the Javascript files of the theme and the calling survey.applyTheme():

<!-- In classic script applications: -->
<head>
    <!-- ... -->
    <link href="https://unpkg.com/survey-core/defaultV2.min.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="https://unpkg.com/survey-core/survey.core.min.js"></script>
    <script type="text/javascript" src="https://unpkg.com/survey-core/themes/contrast-dark.min.js"></script>
    <script type="text/javascript" src="https://unpkg.com/survey-core/themes/contrast-light.min.js"></script>
    <!-- ... -->
</head>
<script>
const surveyJson = { ... };
const survey = new Survey.Model(surveyJson);
survey.applyTheme(SurveyTheme.ContrastLight);
</script>

The problem is that each Javascript theme file overrides the SurveyTheme object. So in this case, ContrastLight would be available but ContrastDark wouldn't.

  • I check the SurveyTheme object in the browse console and it only had one theme
  • I tried changing the order of the JS files to prove that only could be available at a time

1 Answer 1

0

You can load all the themes:

<script type="text/javascript" src="https://unpkg.com/survey-core/themes/index.js"></script>
Sign up to request clarification or add additional context in comments.

2 Comments

The tradeoff here, which is acceptable for my use case, is that index.js is fairly large at 180kb (minified).
Undortunately you right :-(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.