Skip to main content

Theme Customization

Introduction

Theme CSS variables are a powerful tool that significantly improves the developer experience related to theming and customization. They allow a value to be set in one place and then used in multiple places, making it possible to change CSS dynamically at runtime.

With CSS variables, you can inject your own theme and easily control the look of the application. Whether it's small tweaks to make it more consistent with your page styles or completely new themes.

Understanding the Color System

The Mimeeq color system is built around a consistent approach to color generation that enables powerful customization while maintaining visual harmony.

Color Structure

Each color in our system follows a consistent pattern:

  1. Main Colors: Each color palette has a main color (usually at the 1000 position) that serves as the anchor for the entire palette.

  2. Color Ranges: From each main color, a range of shades (50-1000) is automatically generated, where:

    • 50 is the lightest shade
    • 1000 is the darkest/main color
  3. Legacy Keys: For backward compatibility, each color also has light and dark variants:

    • light typically maps to shade 50
    • dark is a darker variation of the main color

Color Generation

When you customize a main color like --mmq-accent-main, all related shades are automatically generated using color manipulation algorithms that:

  • Create lighter shades (50-900) by incrementally lightening the main color
  • Set specific variants like light and dark based on mathematical relationships to the main color
  • Generate appropriate contrast text colors based on accessibility standards
/* Example: Customizing accent color and seeing generated variations */
:root {
--mmq-accent-main: #0056b3;

/* These values are automatically generated: */
/* --mmq-accent-50: rgb(229, 239, 247); */
/* --mmq-accent-100: rgb(217, 232, 244); */
/* --mmq-accent-light: rgb(229, 239, 247); */
/* --mmq-accent-dark: rgb(0, 59, 120); */
/* etc. */
}

Special Accent Color

The accent color is particularly important in the Mimeeq system:

  • It represents your brand identity throughout the application
  • It's used for interactive elements, highlights, and key UI components
  • It's the color most commonly customized by users

The accent color can be customized in several ways:

  1. Customer Account: Set in the customer portal for all embeds
  2. Embed Template: Specified in embed template settings
  3. Inline: Set directly on specific mmq-embed elements (use sparingly)

When you customize the accent color, all related shades (50-1000, light, dark) are automatically generated to maintain a consistent color scheme.

Practical Example: Brand Customization

Here's how you might customize the accent color to match a brand's identity:

/* Apply brand colors to Mimeeq embed */
:root {
/* Main brand color */
--mmq-accent-main: #ff5722;

/* Optional: Override text color on accent backgrounds */
--mmq-accent-contrast-text: #ffffff;

/* Optional: Adjust background to complement the brand */
--mmq-background-primary: #fafafa;

/* Optional: Customize hotspot colors */
--mmq-hot-spots-color: rgba(255, 87, 34, 0.2);
--mmq-hot-spots-border-color: rgba(255, 87, 34, 0.7);
}

Customizable Theme Elements

Mimeeq allows for theme customization at different levels. The following elements can be customized either through customer account settings or embed templates:

Primary Customization Options

SettingDescriptionCSS VariableDefault Value
accentColorThe primary brand color--mmq-accent-main#ac1015
accentTextColorText color on accent backgrounds--mmq-accent-contrast-text#fff or #000 based on contrast
backgroundColorMain background color--mmq-background-primary#fff
hotSpots.colorColor of hotspots--mmq-hot-spots-color20% opacity of accent color
hotSpots.borderColorBorder color of hotspots--mmq-hot-spots-border-color70% opacity of accent color
group.activeColorBackground color for active groups--mmq-group-active-colorrgb(86, 85, 83)
group.hoverColorBackground color for hovered groups--mmq-group-hover-colorrgb(86, 85, 83)
group.openedGroupTextColorText color for opened groups--mmq-group-opened-group-text-colorBLACK
group.hoverGroupTextColorText color for hovered groups--mmq-group-hover-group-text-colorBLACK
mesh.overlayOverlay color for meshInternalVaries

Advanced Theme Customization

For more extensive customization, you can override any of the global CSS variables defined below. This can be useful when you need to:

  1. Create a fully branded experience that matches your website
  2. Implement a dark mode by overriding background and text colors
  3. Improve accessibility by adjusting contrast ratios and focus states
/* Example of more advanced customization */
:root {
/* Brand colors */
--mmq-accent-main: #8e44ad;
--mmq-accent-contrast-text: #ffffff;

/* Dark mode */
--mmq-background-primary: #121212;
--mmq-background-white: #1e1e1e;
--mmq-typography-primary: #e0e0e0;
--mmq-typography-secondary: #bbbbbb;

/* Borders and shadows */
--mmq-border-light: rgba(255, 255, 255, 0.1);
--mmq-box-shadow-primary: rgba(0, 0, 0, 0.3);

/* Adjust scrollbars for dark theme */
--mmq-scrollbar-primary: rgba(255, 255, 255, 0.2);
--mmq-scrollbar-secondary: rgba(255, 255, 255, 0.05);
}

Global CSS Variables

Mimeeq Embed is built with CSS variables for easy customization of the application. Below is a comprehensive list of all available global variables organized by category.

Theme Colors

Accent Colors

These colors represent the primary branding color. The --mmq-accent-main is the most important variable as other shades are generated from it.

VariableDescriptionDefault Value
--mmq-accent-mainMain accent color#ac1015 (customizable)
--mmq-accent-contrast-textText on accent color#fff
--mmq-accent-lightLight accent colorrgb(246, 231, 231)
--mmq-accent-darkDark accent colorrgb(94, 8, 11)
--mmq-accent-50Lightest accent shadergb(246, 231, 231)
--mmq-accent-100Accent shade 100rgb(242, 219, 220)
--mmq-accent-200Accent shade 200rgb(234, 197, 198)
--mmq-accent-300Accent shade 300rgb(227, 174, 176)
--mmq-accent-400Accent shade 400rgb(219, 151, 154)
--mmq-accent-500Accent shade 500rgb(211, 129, 131)
--mmq-accent-600Accent shade 600rgb(203, 106, 109)
--mmq-accent-700Accent shade 700rgb(195, 83, 87)
--mmq-accent-800Accent shade 800rgb(187, 61, 65)
--mmq-accent-900Accent shade 900rgb(179, 38, 43)
--mmq-accent-1000Darkest accent shade#ac1015

Primary Colors

These colors define the UI foundation and are generally not meant to be customized.

VariableDescriptionDefault Value
--mmq-primary-mainMain primary color#2e3341
--mmq-primary-contrast-textText on primary color#fff
--mmq-primary-lightLight primary colorrgb(234, 234, 236)
--mmq-primary-darkDark primary colorrgb(25, 28, 35)
--mmq-primary-50Lightest primary shadergb(234, 234, 236)
--mmq-primary-100Primary shade 100rgb(224, 224, 227)
--mmq-primary-200Primary shade 200rgb(204, 205, 209)
--mmq-primary-300Primary shade 300rgb(184, 186, 191)
--mmq-primary-400Primary shade 400rgb(164, 166, 173)
--mmq-primary-500Primary shade 500rgb(145, 147, 155)
--mmq-primary-600Primary shade 600rgb(125, 128, 137)
--mmq-primary-700Primary shade 700rgb(105, 108, 119)
--mmq-primary-800Primary shade 800rgb(85, 89, 101)
--mmq-primary-900Primary shade 900rgb(65, 70, 83)
--mmq-primary-1000Darkest primary shade#2e3341

Status Colors

Colors used for notifications, alerts, and status indicators.

VariableDescriptionDefault Value
--mmq-success-mainMain success color#49bf5a
--mmq-success-contrast-textText on success color#fff
--mmq-success-lightLight success color#ecf8ee
--mmq-success-darkDark success color#22805f
--mmq-success-50 to --mmq-success-1000Full success shade rangeVarious values
--mmq-error-mainMain error color#e74c3c
--mmq-error-contrast-textText on error color#fff
--mmq-error-lightLight error colorrgba(231, 76, 60, 0.2)
--mmq-error-darkDark error color#cc292e
--mmq-error-50 to --mmq-error-1000Full error shade rangeVarious values
--mmq-warningWarning color#faac25
--mmq-color-blueBlue accent color#1762d4
--mmq-status-activeStatus active indicator#22805f
--mmq-status-inactiveStatus inactive indicator#e74c3c
--mmq-status-openStatus open indicator#82858d

Common Colors

VariableDescriptionDefault Value
--mmq-common-whiteWhite color#fff
--mmq-common-blackBlack color#000
--mmq-typeTheme type (light/dark)light
--mmq-hot-spots-colorColor for hotspots#ac101533
--mmq-hot-spots-border-colorBorder color for hotspots#ac1015B3

Grayscale

The grayscale palette provides consistent neutral colors throughout the interface.

VariableDescriptionDefault Value
--mmq-grey-50Lightest gray#f4f4f4
--mmq-grey-100Gray 100#ebebec
--mmq-grey-200Gray 200#d5d6d9
--mmq-grey-300Gray 300#c1c2c6
--mmq-grey-400Gray 400#abadb3
--mmq-grey-500Gray 500#96989f
--mmq-grey-600Gray 600#82858d
--mmq-grey-700Gray 700#6d717a
--mmq-grey-800Gray 800#585c67
--mmq-grey-900Gray 900#434854
--mmq-grey-1000Darkest gray#2e3341

Typography Colors

These variables control text colors throughout the application.

VariableDescriptionDefault Value
--mmq-typography-primaryMain text color#2e3341
--mmq-typography-secondarySecondary text color#434854
--mmq-typography-tertiaryTertiary text color#6d717a
--mmq-typography-headerHeader text color#001136
--mmq-typography-tableTable text colorrgba(46, 51, 65, 0.8)
--mmq-typography-iconIcon colorrgba(46, 51, 65, 0.6)
--mmq-typography-hintHint text colorrgba(46, 51, 65, 0.5)
--mmq-typography-darkDark text color#96989f
--mmq-typography-greyGrey text color#8f9198

Backgrounds

These variables control background colors for different UI elements.

VariableDescriptionDefault Value
--mmq-background-primaryPrimary background#f4f4f4
--mmq-background-whiteWhite background#fff
--mmq-background-overlayOverlay backdroprgba(46, 51, 65, 0.6)
--mmq-background-foregroundModal backdroprgba(46, 51, 65, 0.3)
--mmq-background-lightLight background#f2f2f7
--mmq-background-greyGrey background#f6f6f6
--mmq-background-darkDark background#96989f
--mmq-background-tooltipTooltip background#f9f9f9
--mmq-background-dangerDanger alert background#fef6f5

These variables control the application header appearance.

VariableDescriptionDefault Value
--mmq-header-backgroundHeader background color#202532
--mmq-header-colorHeader text color#c1c2c6
--mmq-header-borderHeader border color#373b47
--mmq-header-focusHeader focus state color#535764

Interface Elements

These variables control common UI elements like scrollbars, shadows, and borders.

VariableDescriptionDefault Value
--mmq-scrollbar-primaryScrollbar thumbrgba(46, 51, 65, 0.2)
--mmq-scrollbar-secondaryScrollbar trackrgba(46, 51, 65, 0.1)
--mmq-scrollbar-shadowScrollbar shadowrgba(0, 0, 0, 0.3)
--mmq-box-shadow-primaryPrimary shadowrgba(46, 51, 65, 0.08)
--mmq-box-shadow-secondarySecondary shadowrgba(46, 51, 65, 0.16)
--mmq-border-lighterLightest borderrgba(46, 51, 65, 0.04)
--mmq-border-lightLight border#2e33411a
--mmq-border-mediumMedium borderrgba(46, 51, 65, 0.2)
--mmq-border-darkDark border#ededee
--mmq-border-focusFocus borderrgba(46, 51, 65)
--mmq-border-tableTable borderrgba(199, 199, 209, 0.2)
--mmq-group-active-colorActive group backgroundrgb(86, 85, 83)
--mmq-group-hover-colorHover group backgroundrgb(86, 85, 83)
--mmq-group-opened-group-text-colorText color for opened groupBLACK
--mmq-group-hover-group-text-colorText color for hovered groupBLACK

Typography Weights and Sizes

These variables define consistent font sizes and weights throughout the application.

VariableDescriptionDefault Value
--mmq-font-weight-lightLight font weight300
--mmq-font-weight-regularRegular font weight400
--mmq-font-weight-mediumMedium font weight500
--mmq-font-weight-boldBold font weight700
--mmq-font-size-baseBase font size16px
--mmq-font-size-regularRegular font size14px
--mmq-font-size-smallSmall font size12px
--mmq-font-size-headerHeader font size10px

Working with CSS Variables

Setting Variables

There are several ways to set CSS variables depending on your needs:

Global Setting

To apply changes across the entire application, set variables on the :root selector:

:root {
--mmq-accent-main: #2196f3;
--mmq-background-primary: #fafafa;
}

Component-Specific Setting

To customize a specific component without affecting others:

.mmq-button {
--mmq-button-border-radius: 8px;
--mmq-button-padding: 12px 24px;
}

.mmq-dialog {
--mmq-dialog-max-width: 800px;
}

Media Query Adaptation

Adjust variables based on screen size:

/* Default mobile-first values */
:root {
--mmq-sidepanel-width: 100%;
--mmq-font-size-regular: 16px;
}

/* Adjust for larger screens */
@media (min-width: 840px) {
:root {
--mmq-sidepanel-width: 320px;
--mmq-font-size-regular: 14px;
}
}

@media (min-width: 1200px) {
:root {
--mmq-sidepanel-width: 379px;
}
}

Dynamic Setting with JavaScript

For runtime customization:

// Access an element
const configurator = document.querySelector('mmq-variant-ui');

// Change its accent color dynamically
configurator.style.setProperty('--mmq-accent-main', userSelectedColor);

// Reset to default for all elements
document.documentElement.style.setProperty('--mmq-accent-main', '#ac1015');

Reading Variables

In CSS

Use the var() function to reference variables:

.custom-element {
background-color: var(--mmq-accent-main);
color: var(--mmq-typography-primary);
border: 1px solid var(--mmq-border-light);
box-shadow: 0 2px 8px var(--mmq-box-shadow-primary);
}

You can also provide fallback values:

.custom-element {
background-color: var(--mmq-custom-color, var(--mmq-accent-main, #ac1015));
}

In JavaScript

Read variable values for dynamic operations:

// Get the current accent color
const accentColor = getComputedStyle(document.documentElement)
.getPropertyValue('--mmq-accent-main')
.trim();

// Use it for calculations or dynamic changes
console.log(`Current accent color: ${accentColor}`);

// Check if we're using a dark background
const bgColor = getComputedStyle(document.querySelector('mmq-variant-ui'))
.getPropertyValue('--mmq-background-primary')
.trim();
const isDarkBg = getLuminance(bgColor) < 0.5;

Common Customization Examples

Basic Brand Customization

The most common customization is changing the accent color to match a brand:

:root {
--mmq-accent-main: #e91e63; /* Brand primary color */
--mmq-accent-contrast-text: #ffffff; /* Text color on brand color */
}

Dark Mode

Create a dark theme by adjusting background and text colors:

:root {
/* Dark backgrounds */
--mmq-background-primary: #121212;
--mmq-background-white: #1e1e1e;
--mmq-background-light: #2d2d2d;
--mmq-background-grey: #2a2a2a;

/* Light text */
--mmq-typography-primary: #e0e0e0;
--mmq-typography-secondary: #bbbbbb;
--mmq-typography-tertiary: #999999;

/* Adjusted borders and shadows */
--mmq-border-light: rgba(255, 255, 255, 0.1);
--mmq-box-shadow-primary: rgba(0, 0, 0, 0.5);

/* Adjust scrollbars for dark theme */
--mmq-scrollbar-primary: rgba(255, 255, 255, 0.2);
--mmq-scrollbar-secondary: rgba(255, 255, 255, 0.05);

/* Adjust common colors */
--mmq-common-white: #1e1e1e; /* Override white for dark mode */
}

Custom Layout Dimensions

Adjust the layout dimensions for different device contexts:

:root {
/* Configurator dimensions */
--mmq-configurator-container-max-height: 800px;
--mmq-configurator-container-min-height: 400px;
--mmq-sidepanel-width: 350px;

/* Mobile-specific adjustments */
@media (max-width: 839px) {
--mmq-canvas-height: 250px;
--mmq-configurator-wrapper-mobile-vertical-padding: 0px;
--mmq-mobile-tabs-min-height: 150px;
}
}

Basket Customization

Customize the basket appearance and positioning:

:root {
/* Basket button position */
--mmq-basket-button-position-right: 20px;
--mmq-basket-button-position-bottom: 20px;

/* Basket styling */
--mmq-basket-button-background: var(--mmq-accent-main);
--mmq-basket-button-color: #ffffff;
--mmq-basket-button-radius: 50%; /* Make it circular */

/* Basket panel */
--mmq-basket-panel-position-right: 0;
--mmq-basket-header-content-flow: row-reverse;
}

Further Resources