UNPKG

nice-ui

Version:

React design system, components, and utilities

28 lines (27 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Styles = void 0; const Colors_1 = require("./color/Colors"); const Fonts_1 = require("./font/Fonts"); const light_1 = require("./theme/light"); const dark_1 = require("./theme/dark"); // import {Color} from './color/Color'; class Styles { constructor(theme) { this.theme = theme; this.g = (shade, opacity = 1) => { const g = Math.round(255 * shade); return `rgba(${g},${g},${g},${opacity})`; // const {col} = this; // const step = Math.round((1 - L) * 11); // const color0 = col.col(['neutral', 0, step]); // const {H, S, light} = color0; // return new Color(H, S, L * 100 - 100, A * 100, light) + ''; }; this.light = theme.light ?? true; this.col = new Colors_1.Colors(theme.color); this.txt = new Fonts_1.Fonts(theme.font); } } exports.Styles = Styles; Styles.make = (theme, dark) => new Styles(theme ?? (dark ? dark_1.theme : light_1.theme));