Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

magic-color

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magic-color - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

71

dist/index.d.ts

@@ -17,2 +17,20 @@ import { ColorType, Colors, Opacity, RgbColor, HslColor, HsbColor, LabColor } from '@magic-color/core';

}
interface Shade {
key: number;
color: string;
}
interface NormalizedShade extends Shade {
delta: number;
lightnessDiff: number;
}
interface BasicColorShades {
id: string;
name: string;
shades: Shade[];
}
interface ClosestColorShades extends BasicColorShades {
shades: NormalizedShade[];
closestShade: NormalizedShade;
closestShadeLightness: NormalizedShade;
}
interface ThemeOptions {

@@ -100,3 +118,50 @@ /**

declare function calcWCAG(c1: string, c2: string): number;
interface ReadableOptions {
bgColor: string;
/**
* The text color. Default is `#ffffff`.
*
* 文本颜色,默认为 `#ffffff`。
*/
textColor?: string;
/**
* The ratio of the contrast ratio. Default is `4.5`.
*
* 对比度比值,默认为 `4.5`。
*/
ratio?: number;
/**
* The text color when the contrast ratio is not met. Default is `#000000`.
*
* 当对比度不符合时的文本颜色,默认为 `#000000`。
*/
fallbackTextColor?: string;
}
/**
* Get the readable Text color with `WCAG` standard.
*
* 使用 `WCAG` 标准获取可读性文本颜色。
*
* @param options {@link ReadableOptions} The background color or option Configuration.
*/
declare function getReadableTextColor(options: string): string;
declare function getReadableTextColor(options: ReadableOptions): string;
/**
* Determine whether a color is a warm color.
*
* 判断颜色是否是暖色。
*
* @param color The color to be judged.
*
* @returns Whether the color is a warm color.
*
* @example
* ```ts
* isWarmColor('#ff0000') // true
* isWarmColor('#00ff00') // false
* ```
*/
declare function isWarmColor(color: string): boolean;
interface ColorObject<T extends ColorType> {

@@ -149,3 +214,3 @@ type: T;

var valid: (color: string) => boolean;
var random: (type?: keyof Colors) => string;
var random: (type?: ColorType) => string;
var hash: typeof hash;

@@ -157,4 +222,6 @@ var theme: typeof theme;

var apcaReverse: typeof reverseAPCA;
var readable: typeof getReadableTextColor;
var warm: typeof isWarmColor;
}
export { type ColorObject, Magicolor, mc };
export { type BasicColorShades, type ClosestColorShades, type ColorObject, Magicolor, type ThemeMetas, type ThemeOptions, mc };

4

package.json
{
"name": "magic-color",
"type": "module",
"version": "1.1.0",
"version": "1.1.1",
"description": "Magic color creator.",

@@ -42,3 +42,3 @@ "author": "Chris <hizyyv@gmail.com>",

"chroma-js": "^2.4.2",
"@magic-color/core": "1.1.0"
"@magic-color/core": "1.1.1"
},

@@ -45,0 +45,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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