Skip to content

Color scheme configuration

Color schemes allow you to define and manage custom color palettes in your content item templates. With this feature, you can create consistent brand colors, apply them throughout your project, and make them available in the eWizard Editor color picker.

Color schemes configuration involves the following:

  • Defining scheme and scheme.color for your required theme in ./themes/your-theme/theme.js
  • Reserved color categories
  • Color picker options configuration

Setting up color schemes

To configure custom color schemes, add them to the ./themes/your-theme/theme.js file. For example,

js
// ./themes/aethercare/theme.js
module.exports.schemes = {
  scheme1: {
    color1: '#000000',
    color2: '#ffffff',
  },
  scheme2: {
    color1: '#336699',
    color2: '#CCDDEE',
  }
};

// Map scheme colors to reserved color categories
module.exports.colors = (scheme) => {
  return {
    brandColors: {
      color1: scheme.color1,
      color2: scheme.color2,
    },
  };
};

This configuration consists of two main parts:

  • schemes defines named color schemes with specific color values
  • colors maps colors from the active scheme to specific color categories used in the template

Color categories

The colors function can return the following reserved color categories:

Reserved color nameDescription
brandColorsDefault color configuration for brand identity
blockBackgroundColorsColors available for block backgrounds
componentBackgroundColorsColors available for component backgrounds
containerBackgroundColorsColors available for container backgrounds
generalBackgroundColorsColors available for content backgrounds
propColorsColors available for component properties
textColorsColors available for text elements

Using colors in templates

Once configured, you can apply these colors in your templates using the $theme object.

  • Apply colors with style bindings:

    jsx
    <div :style="{ 'background-color': $theme.blockBackgroundColors.color1 }"></div>
  • Apply colors to properties:

    jsx
    <div :propName="$theme.blockBackgroundColors.color1"></div>

Color picker configuration

To customize which colors appear in eWizard Editor's color picker for specific components and properties, use the following reserved color category attributes:

Reserved attributeDescription
data-background-colorsApplies to background color options
data-prop-colorsApplies to property color options
data-text-colorsApplies to text color options

Examples

  • Text color configuration:
    html
    <wiz-text text="Text colors" data-text-colors="customTextColors"></wiz-text>
  • Background color configuration:
    html
    <wiz-text text="Some text" data-background-colors="customBackgroundColors"></wiz-text>
  • Property color configuration:
    html
    <wiz-social-follow-icons data-prop-colors="customPropColors"></wiz-social-follow-icons>

The values used in these attributes (like customTextColors) must match color categories defined in your ./themes/your-theme/theme.js file.

Once your dynamic template is ready, archive it with wiz archive and upload it to eWizard. When users select your template to create content items, they will see theme-specific color schemes, based on the selected theme.