New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

magic-color

Package Overview
Dependencies
Maintainers
1
Versions
18
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 0.0.3 to 0.0.4

62

dist/index.d.ts

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

type ColorType = 'hsl' | 'hsb' | 'rgb' | 'hex';
type ColorType = 'hsl' | 'hsb' | 'rgb' | 'hex' | 'keyword';
type hslColor = [number, number, number];
type hsbColor = [number, number, number];
type rgbColor = [number, number, number];
type hexColor = string;
type keywordColor = string;
type Color = hslColor | hsbColor | rgbColor | hexColor | keywordColor;
declare const keywordColors: Record<string, hexColor>;
type ColorKeyword = keyof typeof keywordColors;
declare function isHex(color: string): boolean;

@@ -7,23 +15,45 @@ declare function isHsl(color: string): boolean;

declare function isHsb(color: string): boolean;
declare function isKeyword(color: string): color is ColorKeyword;
declare function isColor(color: string): boolean;
declare function getColorType(color: string): ColorType | null;
declare function rgbToHex(color: string): string;
declare function rgbToHsl(color: string): string;
declare function rgbToHsb(color: string): string;
declare function hslToHex(color: string): string;
declare function hslToRgb(color: string): string;
declare function hslToHsb(color: string): string;
declare function hexToRgb(color: string): string;
declare function hexToHsl(color: string): string;
declare function hexToHsb(color: string): string;
declare function hsbToHex(color: string): string;
declare function hsbToRgb(color: string): string;
declare function hsbToHsl(color: string): string;
declare function rgbToHex(color: rgbColor | string): hexColor;
declare function rgbToHsl(color: rgbColor | string): hslColor;
declare function rgbToHsl(color: rgbColor | string, toString: false): hslColor;
declare function rgbToHsl(color: rgbColor | string, toString: true): string;
declare function rgbToHsl(color: rgbColor | string, toString: boolean): hslColor | string;
declare function rgbToHsb(color: rgbColor | string): hsbColor;
declare function rgbToHsb(color: rgbColor | string, toString: false): hsbColor;
declare function rgbToHsb(color: rgbColor | string, toString: true): string;
declare function rgbToHsb(color: rgbColor | string, toString: boolean): hsbColor | string;
declare function hslToHex(color: hslColor | string): hexColor;
declare function hslToRgb(color: hslColor | string, toString?: boolean): rgbColor | string;
declare function hslToHsb(color: hslColor | string, toString?: boolean): hsbColor | string;
declare function hexToRgb(color: hexColor, toString?: boolean): rgbColor | string;
declare function hexToHsl(color: hexColor, toString?: boolean): hsbColor | string;
declare function hexToHsb(color: hexColor, toString?: boolean): hsbColor | string;
declare function hsbToHex(color: hsbColor | string): hexColor;
declare function hsbToRgb(color: hsbColor | string, toString?: boolean): rgbColor | string;
declare function hsbToHsl(color: hsbColor | string, toString?: boolean): hslColor | string;
/**
* Convert color from one format to another.
* @param colorString valid color string
* @param targetFormat ColorType
* @param format ColorType
* @returns Result of ColorType
*/
declare function convertColor(colorString: string, targetFormat: ColorType): string | null;
declare function convertColor(colorString: string, format: 'rgb'): rgbColor | null;
declare function convertColor(colorString: string, format: 'rgb', toString: false): rgbColor | null;
declare function convertColor(colorString: string, format: 'rgb', toString: true): string | null;
declare function convertColor(colorString: string, format: 'rgb', toString: boolean): rgbColor | string | null;
declare function convertColor(colorString: string, format: 'hsl'): hslColor | null;
declare function convertColor(colorString: string, format: 'hsl', toString: false): hslColor | null;
declare function convertColor(colorString: string, format: 'hsl', toString: true): string | null;
declare function convertColor(colorString: string, format: 'hsl', toString: boolean): hslColor | string | null;
declare function convertColor(colorString: string, format: 'hsb'): hsbColor | null;
declare function convertColor(colorString: string, format: 'hsb', toString: false): hsbColor | null;
declare function convertColor(colorString: string, format: 'hsb', toString: true): string | null;
declare function convertColor(colorString: string, format: 'hsb', toString: boolean): hsbColor | string | null;
declare function convertColor(colorString: string, format: 'hex'): hexColor | null;
declare function convertColor(colorString: string, format: 'hex', toString: false): hexColor | null;
declare function convertColor(colorString: string, format: 'hex', toString: true): string | null;
declare function convertColor(colorString: string, format: 'hex', toString: boolean): hexColor | string | null;

@@ -86,2 +116,2 @@ interface ThemeMetas {

export { type ColorType, type ThemeMetas, type ThemeOptions, convertColor, getColorType, hexToHsb, hexToHsl, hexToRgb, hsbToHex, hsbToHsl, hsbToRgb, hslToHex, hslToHsb, hslToRgb, isColor, isHex, isHsb, isHsl, isRgb, rgbToHex, rgbToHsb, rgbToHsl, theme };
export { type Color, type ColorType, type ThemeMetas, type ThemeOptions, convertColor, getColorType, type hexColor, hexToHsb, hexToHsl, hexToRgb, type hsbColor, hsbToHex, hsbToHsl, hsbToRgb, type hslColor, hslToHex, hslToHsb, hslToRgb, isColor, isHex, isHsb, isHsl, isKeyword, isRgb, type keywordColor, type rgbColor, rgbToHex, rgbToHsb, rgbToHsl, theme };
{
"name": "magic-color",
"type": "module",
"version": "0.0.3",
"version": "0.0.4",
"packageManager": "pnpm@8.14.0",

@@ -6,0 +6,0 @@ "description": "Magic color creator.",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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