3.0.1 • Published 10 months ago

@unifyux/theme v3.0.1

Weekly downloads
245
License
MIT
Repository
github
Last release
10 months ago

@unifyux/theme

This package outputs a single source of truth for standard values of common elements of a design system for use in JS, SASS, and CSS.

Demo

yarn demo

Build

yarn build

Usage

CSS & SASS variables may be used directly from package / node_modules.

CSS: {node_modules}/@unifyux/theme/unify.css

SASS: {node_modules}/@unifyux/theme/unify.scss

Using CSS variables

For JS, you should be able to import the module directly from the package @unifyux/theme, whether you are using CommonJS or ES2015 modules. A UMD module is also provided, which can be used by a <script> tag.

Example Usage

Use CSS Variable in CSS

@import '@unifyux/theme/unify.css';

Use CSS Variables in HTML

<link rel="stylesheet" href="./node_modules/@unifyux/theme/unify.css" type="text/css" media="screen" />

import SASS

@import "@unifyux/theme/unify.scss";

import module in JS (ES6)

import { unify } from '@unifyux/theme';

Import JS module in HTML

<script type="module" src="./node_modules/@unifyux/theme/dist/theme.esm.js"></script>

import JS module in HTML (UMD for legacy browsers)

<script nomodule src="./node_modules/@unifyux/theme/dist/theme.umd.js"></script>

import module in JS (Common JS, RequireJS)

const theme = require('@unifyux/theme');

After Importing Module, Use Variables

Having used CommonJS require():

const blue = theme.unify.blue;
const primary = theme.unify.primary;

Having used ES2015 import:

const blue = unify.blue;
const primary = unify.primary;

Output and documentation

  • List of value options and what they are for each area in all 3 forms

Adding new values

Add them to the unify.css file as a CSS variable.

Insights / Challenges this package addresses

  • No clear, documented single source of truth for UI element values
  • Missing way to assign in code vs CSS class (i.e. set color variable in javascript)
  • Direct access to color variables (SCSS/SASS)
  • Default values (like colors) in external libraries are never changed from defaults in practice in applications

Suggested (SASS)

Sources / Inspiration / Notes

3.0.1

10 months ago

2.0.28

2 years ago

2.0.29

2 years ago

2.0.27

2 years ago

2.0.26

2 years ago

2.0.24

2 years ago

2.0.25

2 years ago

2.0.23

2 years ago

2.0.22

2 years ago

2.0.20

2 years ago

2.0.21

2 years ago

2.0.19

2 years ago

2.0.16

2 years ago

2.0.17

2 years ago

2.0.18

2 years ago

2.0.15

2 years ago

2.0.14

3 years ago

2.0.13

3 years ago

2.0.12

3 years ago

2.0.11

3 years ago

2.0.10

4 years ago

2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

1.0.3-alpha.46

4 years ago

1.0.3-alpha.52

4 years ago

1.0.3-alpha.43

4 years ago

1.0.3-alpha.68

4 years ago

1.0.2

4 years ago

1.0.2-alpha.3

4 years ago

1.0.1

4 years ago

1.0.1-alpha.352

4 years ago