Socket
Socket
Sign inDemoInstall

@chasi/ui

Package Overview
Dependencies
Maintainers
1
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chasi/ui - npm Package Compare versions

Comparing version 0.2.101 to 0.2.102

2

dist/theme.d.ts

@@ -8,2 +8,4 @@ export interface ThemeGeneratorConfig {

colorScheme: 'light' | 'dark';
lightColor: string;
darkColor: string;
colors: {

@@ -10,0 +12,0 @@ brand: string[];

15

dist/theme.js

@@ -1,3 +0,1 @@

const LIGHT_COLOR = '#d8dee3';
const DARK_COLOR = '#212529';
export function generateTheme(theme) {

@@ -28,8 +26,9 @@ const useConf = theme;

for (const theme in useConf) {
for (const colorName in useConf[theme].colors) {
const colors = useConf[theme].colors[colorName];
const currentTheme = useConf[theme];
for (const colorName in currentTheme.colors) {
const colors = currentTheme.colors[colorName];
if (colors) {
if (colors.length === 1) {
result += `\t--${colorName}-${theme}: ${colors[0]};\n`;
result += `\t--on-${colorName}-${theme}: ${contrast(colors[0])};\n`;
result += `\t--on-${colorName}-${theme}: ${contrast(colors[0], currentTheme.lightColor, currentTheme.darkColor)};\n`;
}

@@ -40,3 +39,3 @@ else {

result += `\t--${colorName}-${theme}-${i}: ${color};\n`;
result += `\t--on-${colorName}-${theme}-${i}: ${contrast(color)};\n`;
result += `\t--on-${colorName}-${theme}-${i}: ${contrast(color, currentTheme.lightColor, currentTheme.darkColor)};\n`;
}

@@ -89,3 +88,3 @@ }

}
function contrast(hexColor) {
function contrast(hexColor, light, dark) {
const hex = hexColor.replace('#', '');

@@ -96,3 +95,3 @@ const R = parseInt(hex.substring(0, 2), 16);

const brightness = (Math.round(R * 299) + Math.round(G * 587) + Math.round(B * 114)) / 1000;
return brightness >= 128 ? DARK_COLOR : LIGHT_COLOR;
return brightness >= 128 ? dark : light;
}
{
"name": "@chasi/ui",
"version": "0.2.101",
"version": "0.2.102",
"bin": {

@@ -5,0 +5,0 @@ "gen-theme": "./dist/bin/theme.js"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc