Skip to content

Commit

Permalink
chore: fix docs error
Browse files Browse the repository at this point in the history
  • Loading branch information
vtrbo committed Jan 29, 2023
1 parent e59ce06 commit 56e2a89
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 7 deletions.
32 changes: 28 additions & 4 deletions docs/method/color.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Color 函数库

## colorDarken

```ts
/**
* @description 加深颜色
*
* @function colorDarken
* @param { string | number[] } color - 16进制颜色 | RGBA颜色
* @param { number } level - 加深权重 0 - 10 0 自身 10 黑色
* @returns { string | number[] } - HEX | [R, G, B, A]
*/
```

## colorLighten

```ts
/**
* @description 变浅颜色
*
* @function colorLighten
* @param { string | number[] } color - 16进制颜色 | RGBA颜色
* @param { number } level - 加深权重 = 0 0 - 10 0 自身 10 白色
* @param { 'HEX' | 'RGBA' } type - 返回类型 = 'HEX'
* @returns { string | number[] } - HEX | [R, G, B, A]
*/
```

## hexToRgba

```ts
Expand Down Expand Up @@ -30,10 +57,7 @@
* @description RGBA 转 HEX
*
* @function rgbaToHex
* @param { number } r (0 - 255) - 红
* @param { number } g (0 - 255) - 绿
* @param { number } b (0 - 255) - 蓝
* @param { number } [a] (0 - 1) - 透明度
* @param { number[] } rgba - RGBA颜色
* @returns { string } - 16进制颜色
*/
```
Expand Down
4 changes: 2 additions & 2 deletions docs/method/string.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @function decrypt
* @param { string } data - 欲解密数据
* @param { string } salt -
* @param { string } source - 字符库
* @returns { string } - 解密数据
*/
```
Expand All @@ -33,7 +33,7 @@
*
* @function encrypt
* @param { string } data - 欲加密数据
* @param { string } salt -
* @param { string } source - 字符库
* @returns { string } - 加密数据
*/
```
Expand Down
14 changes: 14 additions & 0 deletions packages/color/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
// 此文件为自动生成的导出文件
// 请务必不要在此文件进行修改或其他操作
// 因为你做的所有修改和操作都不会生效
import {
colorDarken,
} from './colorDarken'

import {
colorLighten,
} from './colorLighten'

import {
hexToRgba,
} from './hexToRgba'
Expand Down Expand Up @@ -39,6 +47,8 @@ import {
export const resolveColorUtils = (aliasPrefix?: string): Record<string, [string, string][]> => {
return {
'@vtrbo/utils/color': [
['colorDarken', aliasPrefix ? `${aliasPrefix}ColorDarken` : 'colorDarken'],
['colorLighten', aliasPrefix ? `${aliasPrefix}ColorLighten` : 'colorLighten'],
['hexToRgba', aliasPrefix ? `${aliasPrefix}HexToRgba` : 'hexToRgba'],
['randomHex', aliasPrefix ? `${aliasPrefix}RandomHex` : 'randomHex'],
['rgbaToHex', aliasPrefix ? `${aliasPrefix}RgbaToHex` : 'rgbaToHex'],
Expand All @@ -47,12 +57,16 @@ export const resolveColorUtils = (aliasPrefix?: string): Record<string, [string,
}

export {
colorDarken,
colorLighten,
hexToRgba,
randomHex,
rgbaToHex,
}

export default {
colorDarken,
colorLighten,
hexToRgba,
randomHex,
rgbaToHex,
Expand Down
2 changes: 1 addition & 1 deletion packages/color/rgbaToHex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @description RGBA 转 HEX
*
* @function rgbaToHex
* @param { number[] } rgba -
* @param { number[] } rgba - RGBA颜色
* @returns { string } - 16进制颜色
*/
export const rgbaToHex = (rgba: number[]): string => {
Expand Down

0 comments on commit 56e2a89

Please sign in to comment.