@enapter/design-tokens

0.0.17 • Public • Published

Enapter Design Tokens

Use this for any html/js or react projects to provide unified visual style (Enapter brand colors, typography and etc).

Main Laws

  • Using the same name for colors in light and dark color palettes.
  • Using default Tailwind CSS variables for screen sizes, typography and other things discribed in Tailwind CSS Documentation.

Files

  • colors.css – main color design tokens.
  • colors.js – adopted to use with React Native and etc.
  • tailwind.config.js - adopted to use with Tailwind CSS.

Update Tailwind CSS Config

How to use:

npm i @enapter/design-tokens

Import colors.css file with Enapter Colors as variables in your js script:

// App.js

import '@enapter/design-tokens/colors.css';

Import Enapter theme to your Tailwind CSS configuration:

// tailwind.config.js

const { theme } = require('@enapter/design-tokens/tailwind.config');

/** @type {import('tailwindcss').Config} */
module.exports = {
    // ...
    theme,
};

Colors as CSS variables only

When to use:

  • Any project with Tailwind CSS.
  • Simple HTML projects, minimum of code.

How to use:

npm i @enapter/design-tokens
/* style.css */
@import "@enapter/design-tokens/colors.css";

var(--colors-text)

Also you can use CSS variables Values in JavaScript. Read more →

Colors as JavaScript variables

When to use:

  • Any project with React Native.
  • Any project without HTML, pure JS/TS and etc.

How to use:

npm i @enapter/design-tokens
import { colors, getColorsByTheme } from "@enapter/design-tokens/colors";

const themeColors = getColorsByTheme(themeId);

const labelTextColor = colors.dark.text; // or themeColors.text;

Theme Light/Dark Mode

Use getColorsByTheme(themeId: 'light' | 'dark') to get theme palettes (light/dark mode).

Theme Light/Dark Mode

You can use @enapter/design-theme to provide theme palettes (light/dark mode) automatically. Also you can modify [data-theme="dark"] attribute in <html> tag to change palette to dark.

Package Sidebar

Install

npm i @enapter/design-tokens

Weekly Downloads

51

Version

0.0.17

License

MIT

Unpacked Size

24.5 kB

Total Files

11

Last publish

Collaborators

  • zmnv
  • enapteruser