You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP

@netlify/netlify-design-tokens

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@netlify/netlify-design-tokens

Netlify's design tokens for sharing across products and repos

6.0.0-beta.4
100

Supply Chain Security

100

Vulnerability

92

Quality

89

Maintenance

100

License

Version published
Weekly downloads
85K
-4.9%
Maintainers
19
Weekly downloads
 
Created

Netlify Design Tokens NPM version

Usage

Install the package in the project of your choice:

yarn add -D @netlify/netlify-design-tokens

From there, you may import any of the dist files into your codebase for reuse as desired:

CSS

Basic usage:

@import '@netlify/netlify-design-tokens/dist/css/colors.css';

.myComponent {
  color: var(--color-teal-200);
}

Global dark mode support:

@import '@netlify/netlify-design-tokens/dist/css/colors.css';

:root {
  --colorTeal: var(--facets-teal-200);
}

@media (prefers-color-scheme: dark) {
  :root {
    --colorTeal: var(--facets-teal-500);
  }
}

.myComponent {
  color: var(--colorTeal);
}

Alternatively, use the rgb(<color> / <alpha>) notation to vary color opacity:

@import '@netlify/netlify-design-tokens/dist/css/facets.tailwind.css';

:root {
  --colorTeal: var(--facetsTeal200);
}

@media (prefers-color-scheme: dark) {
  :root {
    --colorTeal: var(--facetsTeal200);
  }
}

.myComponent {
  color: rgb(var(--colorTeal) / 50%);
}

JavaScript

import tokens from '@netlify/netlify-design-tokens';

const teal = tokens.facets.teal.500;

FAQs

Package last updated on 11 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts