magic-color
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -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 }; |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
93990
7144
0
+ Added@magic-color/core@1.1.1(transitive)
- Removed@magic-color/core@1.1.0(transitive)
Updated@magic-color/core@1.1.1