Question T13549
Visible to All Users

Save the changes from the theme tab

created 2 years ago (modified 2 years ago)

[Ticket cloned from T13527: Theme Tab Input field height]

When i change something on the theme tab, no automatic save is triggered and no change has been saved into the json. How to save the changes from the theme tab?

Answers approved by surveyjs Support

created 2 years ago (modified 2 years ago)

Updated

Hello Wolfgang,

Save a custom theme

To save a new theme settings, on the Theme tab, click Export.

View Demo: Theme Tab in Survey Creator

Clipboard-File-2.png

You'll get a JSON containing settings of a custom theme.

Apply a custom theme

To apply a custom theme, a user can Import the theme JSON using the Import option:
Clipboard-File-2.png

To apply a theme before running a survey form, a developer can call the survey.applyTheme function before running a survey.
View Demo: Apply a Custom Theme to a Survey

JavaScript
const survey = new Model(json); survey.applyTheme({ cssVariables: { "--sjs-general-backcolor": "rgba(255, 255, 255, 1)", "--sjs-general-backcolor-dark": "rgba(244, 244, 244, 1)", "--sjs-general-backcolor-dim": "rgba(216, 207, 236, 1)", "--sjs-general-backcolor-dim-light": "rgba(241, 237, 248, 1)", "--sjs-general-forecolor": "rgba(0, 0, 0, 0.91)", "--sjs-general-forecolor-light": "rgba(0, 0, 0, 0.45)", "--sjs-general-dim-forecolor": "rgba(0, 0, 0, 0.91)", "--sjs-general-dim-forecolor-light": "rgba(0, 0, 0, 0.5)", "--sjs-primary-backcolor": "rgba(122, 100, 168, 1)", "--sjs-primary-backcolor-light": "rgba(122, 100, 168, 0.1)", "--sjs-primary-backcolor-dark": "rgba(105, 84, 152, 1)", "--sjs-primary-forecolor": "rgba(255, 255, 255, 1)", "--sjs-base-unit": "8px", "--sjs-corner-radius": "4px", "--sjs-secondary-backcolor": "rgba(255, 152, 20, 1)", "--sjs-secondary-backcolor-light": "rgba(255, 152, 20, 0.1)", "--sjs-secondary-backcolor-semi-light": "rgba(255, 152, 20, 0.25)", "--sjs-secondary-forecolor": "rgba(255, 255, 255, 1)", "--sjs-secondary-forecolor-light": "rgba(255, 255, 255, 0.25)", "--sjs-shadow-small": "0px 2px 4px 0px rgba(0, 0, 0, 0.1),0px 8px 16px 0px rgba(0, 0, 0, 0.1),0px 0px 0px 1px rgba(0, 0, 0, 0.05)", "--sjs-shadow-medium": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "--sjs-shadow-large": "0px 8px 16px 0px rgba(0, 0, 0, 0.1)", "--sjs-shadow-inner": "inset 0px 1px 4px 0px rgba(0, 0, 0, 0.1),inset 0px 0px 0px 1px rgba(0, 0, 0, 0.05)", "--sjs-border-light": "rgba(0, 0, 0, 0.09)", "--sjs-border-default": "rgba(0, 0, 0, 0.16)", "--sjs-border-inside": "rgba(0, 0, 0, 0.16)", "--sjs-special-red": "rgba(229, 10, 62, 1)", "--sjs-special-red-light": "rgba(229, 10, 62, 0.1)", "--sjs-special-red-forecolor": "rgba(255, 255, 255, 1)", "--sjs-special-green": "rgba(25, 179, 148, 1)", "--sjs-special-green-light": "rgba(25, 179, 148, 0.1)", "--sjs-special-green-forecolor": "rgba(255, 255, 255, 1)", "--sjs-special-blue": "rgba(67, 127, 217, 1)", "--sjs-special-blue-light": "rgba(67, 127, 217, 0.1)", "--sjs-special-blue-forecolor": "rgba(255, 255, 255, 1)", "--sjs-special-yellow": "rgba(255, 152, 20, 1)", "--sjs-special-yellow-light": "rgba(255, 152, 20, 0.1)", "--sjs-special-yellow-forecolor": "rgba(255, 255, 255, 1)" } }); return <Survey model={survey} />

Please let me know if you have any questions or require further assistance.

    Show previous comments (3)

      Hello,
      When a user imports the theme, a creator calls the importFromFile function. This function applies a loaded theme to a survey being edited. The theme settings are loaded to the property grid, and a survey is colorized according to the custom theme settings.

      A user can view a survey with the loaded theme applied. If required, the user may modify the uploaded theme and save changes by exporting the modified theme.

        i played around and have some problems detected:

        Clipboard-File-1.png

        • i exported a modified theme with a background picture
        • i reopened the survey creator page and imported the saved theme and checked the theme tab again
        • some of the fields are empty (check screenshot)
        JSON
        { "cssVariables": { "--sjs-general-backcolor": "rgba(255, 255, 255, 1)", "--sjs-general-backcolor-dark": "rgba(248, 248, 248, 1)", "--sjs-general-backcolor-dim": "rgba(243, 243, 243, 1)", "--sjs-general-backcolor-dim-light": "rgba(249, 249, 249, 1)", "--sjs-general-forecolor": "rgba(0, 0, 0, 0.91)", "--sjs-general-forecolor-light": "rgba(0, 0, 0, 0.45)", "--sjs-general-dim-forecolor": "rgba(0, 0, 0, 0.91)", "--sjs-general-dim-forecolor-light": "rgba(0, 0, 0, 0.45)", "--sjs-primary-backcolor": "rgba(25, 179, 148, 1)", "--sjs-primary-backcolor-light": "rgba(25, 179, 148, 0.1)", "--sjs-primary-backcolor-dark": "rgba(20, 164, 139, 1)", "--sjs-primary-forecolor": "rgba(255, 255, 255, 1)", "--sjs-base-unit": "8px", "--sjs-corner-radius": "4px", "--sjs-secondary-backcolor": "rgba(255, 152, 20, 1)", "--sjs-secondary-backcolor-light": "rgba(255, 152, 20, 0.1)", "--sjs-secondary-backcolor-semi-light": "rgba(255, 152, 20, 0.25)", "--sjs-secondary-forecolor": "rgba(255, 255, 255, 1)", "--sjs-secondary-forecolor-light": "rgba(255, 255, 255, 0.25)", "--sjs-shadow-small": "0px 1px 2px 0px rgba(0, 0, 0, 0.15)", "--sjs-shadow-medium": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "--sjs-shadow-large": "0px 8px 16px 0px rgba(0, 0, 0, 0.1)", "--sjs-shadow-inner": "inset 0px 1px 2px 0px rgba(0, 0, 0, 0.15)", "--sjs-border-light": "rgba(0, 0, 0, 0.09)", "--sjs-border-default": "rgba(0, 0, 0, 0.16)", "--sjs-border-inside": "rgba(0, 0, 0, 0.16)", "--sjs-special-red": "rgba(229, 10, 62, 1)", "--sjs-special-red-light": "rgba(229, 10, 62, 0.1)", "--sjs-special-red-forecolor": "rgba(255, 255, 255, 1)", "--sjs-special-green": "rgba(25, 179, 148, 1)", "--sjs-special-green-light": "rgba(25, 179, 148, 0.1)", "--sjs-special-green-forecolor": "rgba(255, 255, 255, 1)", "--sjs-special-blue": "rgba(67, 127, 217, 1)", "--sjs-special-blue-light": "rgba(67, 127, 217, 0.1)", "--sjs-special-blue-forecolor": "rgba(255, 255, 255, 1)", "--sjs-special-yellow": "rgba(255, 152, 20, 1)", "--sjs-special-yellow-light": "rgba(255, 152, 20, 0.1)", "--sjs-special-yellow-forecolor": "rgba(255, 255, 255, 1)" }, "backgroundImage":"/background.jpg", "backgroundImageFit": "contain" }

          Hello,

          I created a separate ticket on your behalf: T13577: Certain theme setting are not applied when Importing a custom theme. We placed it in our processing queue and will process it shortly.