style(projects): format code

This commit is contained in:
Soybean
2023-12-14 21:45:29 +08:00
parent a176dc443e
commit a748166399
127 changed files with 2472 additions and 3006 deletions

View File

@ -1,12 +1,13 @@
import { getColorPaletteFamily } from './palette';
import { getColorName } from './name';
import type { ColorPalette, ColorPaletteNumber, ColorPaletteItem, ColorPaletteFamily } from './type';
import type { ColorPalette, ColorPaletteFamily, ColorPaletteItem, ColorPaletteNumber } from './type';
import defaultPalettes from './json/palette.json';
/**
* get color palette by provided color and color name
* @param color the provided color
* @param colorName color name
* Get color palette by provided color and color name
*
* @param color The provided color
* @param colorName Color name
*/
export function getColorPalette(color: string, colorName: string) {
const colorPaletteFamily = getColorPaletteFamily(color, colorName);
@ -31,10 +32,11 @@ export function getColorPalette(color: string, colorName: string) {
}
/**
* get color by color palette number
* @param color color
* @param num color palette number
* @return color hexcode
* Get color by color palette number
*
* @param color Color
* @param num Color palette number
* @returns Color hexcode
*/
export function getColorByColorPaletteNumber(color: string, num: ColorPaletteNumber) {
const colorPalette = getColorPalette(color, color);
@ -46,9 +48,7 @@ export function getColorByColorPaletteNumber(color: string, num: ColorPaletteNum
export default getColorPalette;
/**
* the builtin color palettes
*/
/** The builtin color palettes */
const colorPalettes = defaultPalettes as ColorPaletteFamily[];
export { getColorName, colorPalettes };

View File

@ -1,4 +1,4 @@
import { getHex, getRgb, getHsl } from './color';
import { getHex, getHsl, getRgb } from './color';
import colorNames from './json/color-name.json';
export function getColorName(color: string) {

View File

@ -1,4 +1,4 @@
import { isValidColor, getHsl, getDeltaE, transformHslToHex } from './color';
import { getDeltaE, getHsl, isValidColor, transformHslToHex } from './color';
import { getColorName } from './name';
import type { ColorPaletteFamily, ColorPaletteFamilyWithNearestPalette } from './type';
import defaultPalettes from './json/palette.json';

View File

@ -1,35 +1,24 @@
/**
* the color palette number
*/
/** The color palette number */
export type ColorPaletteNumber = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950;
/**
* the color palette item
*/
/** The color palette item */
export type ColorPaletteItem = {
/**
* the color hexcode
*/
/** The color hexcode */
hexcode: string;
/**
* the color number
* The color number
*
* @link {@link ColorPaletteNumber}
*/
number: ColorPaletteNumber;
/**
* the color name
*/
/** The color name */
name: string;
};
export type ColorPaletteFamily = {
/**
* the color palette family key
*/
/** The color palette family key */
key: string;
/**
* the color palette family's palettes
*/
/** The color palette family's palettes */
palettes: ColorPaletteItem[];
};
@ -47,17 +36,14 @@ export type ColorPaletteFamilyWithNearestPalette = ColorPaletteFamily & {
};
export type ColorPalette = ColorPaletteFamily & {
/**
* the color map of the palette
*/
/** The color map of the palette */
colorMap: Map<ColorPaletteNumber, ColorPaletteItem>;
/**
* the main color of the palette
* @description which number is 500
* The main color of the palette
*
* Which number is 500
*/
main: ColorPaletteItemWithName;
/**
* the match color of the palette
*/
/** The match color of the palette */
match: ColorPaletteItemWithName;
};