npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cx-theme-variables

v26.3.3

Published

CSS Variables-based theme for Cx applications with customizable colors

Readme

cx-theme-variables

A CSS Variables-based theme for CxJS applications with fully customizable colors at runtime.

Features

  • All colors and visual properties defined as CSS custom properties
  • Default neutral color scheme (black, white, lightgray)
  • Easy runtime customization without rebuilding
  • Compatible with dark mode and theme switching
  • Automatic text contrast calculation using oklch

Installation

npm install cx-theme-variables

or

yarn add cx-theme-variables

Usage

Import the theme in your application

import "cx-theme-variables";

Import the CSS files

@import "cx-theme-variables/dist/reset.css";
@import "cx-theme-variables/dist/widgets.css";
@import "cx-theme-variables/dist/charts.css";
@import "cx-theme-variables/dist/svg.css";

Or import in JavaScript:

import "cx-theme-variables/dist/reset.css";
import "cx-theme-variables/dist/widgets.css";
import "cx-theme-variables/dist/charts.css";
import "cx-theme-variables/dist/svg.css";

Customization

CSS Variables

You can customize the theme by overriding CSS variables on :root or any container element:

:root {
  /* Primary colors */
  --cx-theme-primary-color: #1976d2;

  /* Accent and danger colors */
  --cx-theme-accent-color: #ffc107;
  --cx-theme-danger-color: #d32f2f;

  /* Text colors */
  --cx-theme-text-color: rgba(0, 0, 0, 0.87);

  /* Background colors */
  --cx-theme-background-color: white;
  --cx-theme-surface-color: white;

  /* Border colors */
  --cx-theme-border-color: lightgray;

  /* Active state overlay (use black for light themes, white for dark themes) */
  --cx-theme-active-state-color: black;
  --cx-theme-active-state-hover-amount: 8%;
  --cx-theme-active-state-pressed-amount: 12%;

  /* Shadows */
  --cx-theme-box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --cx-overlay-box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
  --cx-theme-focus-box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.3);

  /* Sizing */
  --cx-theme-border-radius: 4px;
  --cx-theme-font-size: 14px;
  --cx-input-padding-x: 8px;
  --cx-input-padding-y: 5px;
  --cx-box-line-height: 24px;
  --cx-theme-icon-size: 16px;

  /* Component-specific */
  --cx-input-background-color: white;
  --cx-input-border-color: lightgray;
  --cx-grid-header-background-color: #fafafa;
  --cx-grid-header-border-color: lightgray;
  --cx-grid-data-background-color: white;
  --cx-grid-data-border-color: #e0e0e0;
  --cx-calendar-background-color: white;

  /* Transitions */
  --cx-theme-transition: all 0.2s ease;
}

Dark Mode Example

@media (prefers-color-scheme: dark) {
  :root {
    --cx-theme-primary-color: #90caf9;
    --cx-theme-text-color: rgba(255, 255, 255, 0.87);
    --cx-theme-background-color: #121212;
    --cx-theme-surface-color: #1e1e1e;
    --cx-theme-border-color: #424242;
    --cx-theme-active-state-color: white; /* Lighten on hover instead of darken */
    --cx-input-background-color: #2c2c2c;
    --cx-input-border-color: #424242;
    --cx-grid-header-background-color: #2c2c2c;
    --cx-grid-header-border-color: #424242;
    --cx-grid-data-background-color: #1e1e1e;
    --cx-grid-data-border-color: #303030;
    --cx-calendar-background-color: #1e1e1e;
  }
}

Using Presets

The package includes ready-made presets and tweaks that can be applied using renderThemeVariables:

import { renderThemeVariables, defaultPreset } from "cx-theme-variables";

// Apply the default preset
renderThemeVariables(defaultPreset);

Available presets: defaultPreset, darkBluePreset, darkGrayPreset, oceanPreset.

Tweaks

Tweaks are partial theme overrides for adjusting specific aspects. Mix them into a preset using the spread operator:

import {
  renderThemeVariables,
  defaultPreset,
  roundingLarge,
  densityCompact,
  fontInter,
} from "cx-theme-variables";

renderThemeVariables({
  ...defaultPreset,
  ...roundingLarge,
  ...densityCompact,
  ...fontInter,
});

Available tweaks:

  • Rounding: roundingNone, roundingSmall, roundingMedium, roundingLarge, roundingVeryLarge
  • Density: densityMinimal, densityCondensed, densityCompact, densityNormal, densityComfortable, densitySpacious
  • Font: fontSystem, fontInter, fontRoboto, fontOpenSans, fontPoppins, fontLato

Dark Mode with Presets

Use the cssWrapper parameter to scope a preset to a media query:

import {
  renderThemeVariables,
  defaultPreset,
  darkBluePreset,
} from "cx-theme-variables";

// Light theme by default
renderThemeVariables(defaultPreset);

// Dark theme when user prefers dark mode
renderThemeVariables(
  darkBluePreset,
  ":root",
  "@media (prefers-color-scheme: dark)",
);

Custom Selector

Use the selector parameter to scope variables to a specific element:

renderThemeVariables(darkBluePreset, ".dark-section");

Available CSS Variables

| Variable | Default | Description | | ---------------------------------------- | ------------------ | -------------------------------------- | | --cx-theme-primary-color | black | Primary brand color | | --cx-theme-accent-color | lightgray | Accent color for highlights | | --cx-theme-danger-color | #d32f2f | Error/danger color | | --cx-theme-text-color | rgba(0,0,0,0.87) | Default text color | | --cx-theme-background-color | white | Page background | | --cx-theme-surface-color | white | Card/surface background | | --cx-theme-border-color | lightgray | Default border color | | --cx-theme-active-state-color | black | Overlay color for hover/pressed states | | --cx-theme-active-state-hover-amount | 8% | Hover overlay opacity | | --cx-theme-active-state-pressed-amount | 12% | Pressed overlay opacity | | --cx-theme-border-radius | 4px | Default border radius | | --cx-theme-box-shadow | Material shadow | Standard elevation shadow | | --cx-overlay-box-shadow | Material shadow | Overlay/elevated shadow | | --cx-theme-focus-box-shadow | Focus ring | Focus indicator shadow | | --cx-theme-transition | all 0.2s ease | Default transition |

License

See LICENSE.md