Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In Mimcss, a theme is a typed contract: a class derived from css.ThemeDefinition declares the style rules and custom properties components may use, and derived classes provide concrete variants. Activate one implementation to choose the active theme; component styles can refer to the declaration rather than depending on a specific variant. The examples below follow the official Mimcss theming guide; check the live documentation for version-sensitive API details.

1. Declare the theme surface

Start with a class that extends css.ThemeDefinition. It defines the CSS entities consumers are allowed to rely on, not the appearance of a particular variant. A declared class rule can initially have no values:

class BorderTheme extends css.ThemeDefinition {
  borderShape = this.$class();
}

Here, borderShape is the shared class identity. Components can use that entity without knowing whether the eventual border is square or rounded. Mimcss documents this declaration-and-inheritance pattern in its theming guide.

2. Implement variants by extending the declaration

Each implementation derives from the declaration and supplies concrete styles for its inherited entities. The guide’s example uses two border variants:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
class SquareBorderTheme extends BorderTheme {
  borderShape = this.$class({
    border: "1px solid black",
    borderRadius: "0"
  });
}

class RoundBorderTheme extends BorderTheme {
  borderShape = this.$class({
    border: "1px solid black",
    borderRadius: "8px"
  });
}

The inherited property name gives both variants a common interface. TypeScript can check that implementations preserve the declared property type. The values above illustrate the guide’s pattern; choose dimensions and colors appropriate to your own design.

3. Activate an implementation

Activation selects the concrete implementation for a theme declaration:

const borderTheme: BorderTheme = css.activate(SquareBorderTheme);

The returned instance can be typed as BorderTheme. Code that consumes borderTheme.borderShape therefore depends on the declaration, not on SquareBorderTheme. Activating another implementation derived from the same declaration switches that hierarchy to the other variant; it does not make both implementations globally active at once.

4. Define design tokens for color themes

Theme declarations can expose custom properties as typed tokens. Implementations then provide the values, while component styles consume them through $use. Mimcss’s guide demonstrates this with a color theme:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
class ColorTheme extends css.ThemeDefinition {
  foreground = this.$var<string>();
  background = this.$var<string>();
}

class LightColorTheme extends ColorTheme {
  foreground = this.$var({ value: "#111" });
  background = this.$var({ value: "#fff" });
}

class DarkColorTheme extends ColorTheme {
  foreground = this.$var({ value: "#fff" });
  background = this.$var({ value: "#111" });
}

class Panel extends css.StyleDefinition {
  styles = this.$use(ColorTheme);
  panel = this.$class({
    color: this.styles.foreground,
    backgroundColor: this.styles.background
  });
}

The declaration establishes which tokens exist and their types. The light and dark classes assign values, and Panel refers to the declaration’s tokens. Mimcss generates the corresponding CSS custom-property references, so the component style does not need to name either implementation. See the Mimcss theming guide for its token example and API details.

5. Combine independent themes, but distinguish them from variants

Only one implementation in a given theme declaration hierarchy can be active at a time. Separate hierarchies are independent, however: a color theme and a border theme can both be active because they have different declarations. This lets an application manage different concerns separately rather than building every combination into one enormous set of variants.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

For a side-by-side comparison of two color schemes, activating two implementations of ColorTheme globally is not the right model. The Mimcss guide instead demonstrates consuming custom properties under a shared block rule and supplying their values under separate wrapper classes. Each region then receives its own scoped values:

class Comparison extends css.StyleDefinition {
  colors = this.$use(ColorTheme);

  block = this.$class({
    color: this.colors.foreground,
    backgroundColor: this.colors.background
  });

  lightWrapper = this.$class({
    [this.block]: {
      [this.colors.foreground]: "#111",
      [this.colors.background]: "#fff"
    }
  });

  darkWrapper = this.$class({
    [this.block]: {
      [this.colors.foreground]: "#fff",
      [this.colors.background]: "#111"
    }
  });
}

Apply the shared block inside the relevant wrapper to compare the two sets of values in separate regions. The key distinction is scope: ordinary activation chooses one implementation for a declaration hierarchy, whereas these wrapper rules redefine custom properties under distinct CSS selectors. Consult the guide for the exact syntax supported by the Mimcss version in use.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Where this design fits

  • Use a declaration to define the stable surface components may consume.
  • Use derived implementations when the same entities need different concrete values or styles.
  • Use custom-property tokens for values such as foreground and background colors that many components share.
  • Use separate declaration hierarchies for independent concerns that can be active together.
  • Use scoped custom-property overrides for exceptional cases such as displaying two variants side by side.

The Mimcss guide describes externalizing theme classes into regular JavaScript packages as an architectural possibility, as long as the classes derive from the declaration consumers expect. That is a design option, not evidence of a current theme marketplace or a particular set of vendor packages.

Quick Recap

SaleBestseller No. 1
HTML and CSS: Design and Build Websites
HTML and CSS: Design and Build Websites
HTML CSS Design and Build Web Sites; Comes with secure packaging; It can be a gift option
$14.60
SaleBestseller No. 3
SaleBestseller No. 4
Web Design with HTML, CSS, JavaScript and jQuery Set
Web Design with HTML, CSS, JavaScript and jQuery Set
Brand: Wiley; Set of 2 Volumes
$35.05

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.