An ultra-light, universal and concise theme mode
npm install @yfill/themesh
npm install @yfill/theme --save
`
or using yarn:
`sh
yarn add @yfill/theme
`
Usage
- Import resources and use the run method to get started.
`js
import Theme from '@yfill/theme';
Theme.run();
`
`html
`
- Set the theme attribute on the tag.
`
background-color-[?main]-[-10-10]-[?a]-[?hover]
font-color-[?main]-[-10-10]-[?a]-[?hover]
border-color-[?main]-[-10-10]-[?a]-[?hover]
box-shadow-[?main]-[0-2]-[?hover]
font-size-[12-52]-[?hover]
`
- It can also be used by enabling css variables.
`js
Theme.run({
enableCssVariables: true,
});
`
`css
.item {
background-color: var(--background-color-[?main]-[-10-10]-[?a]);
color: var(--font-color-[?main]-[-10-10]-[?a]);
border-color: var(--border-color-[?main]-[-10-10]-[?a]);
box-shadow: var(--box-shadow-[?main]-[0-2]);
font-size: var(--font-size-[12-52]);
}
.item:hover {
background-color: var(--background-color-[?main]-[-10-10]-[?a]);
color: var(--font-color-[?main]-[-10-10]-[?a]);
border-color: var(--border-color-[?main]-[-10-10]-[?a]);
box-shadow: var(--box-shadow-[?main]-[0-2]);
font-size: var(--font-size-[12-52]);
}
`
Code example
`html
class="item variable"
font-size-12
box-shadow-0
border-color--4-a
font-size-52-hover
background-color-2-hover
box-shadow-main-0-hover
border-color-main-1-hover
>
content