@d-matrix/utils 1.29.0 → 1.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +10 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d-matrix/utils",
3
3
  "sideEffects": false,
4
- "version": "1.29.0",
4
+ "version": "1.29.1",
5
5
  "description": "A dozen of utils for Front-End Development",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {
package/readme.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  ![NPM Downloads](https://img.shields.io/npm/dw/%40d-matrix%2Futils)
4
4
  ![npm bundle size](https://img.shields.io/bundlephobia/min/%40d-matrix%2Futils)
5
+ [![NPM version](https://img.shields.io/npm/v/@d-matrix/utils.svg?style=flat)](https://www.npmjs.com/package/@d-matrix/utils)
5
6
 
6
7
  A dozen of utils for Front-End Development
7
8
 
@@ -219,6 +220,15 @@ import { dom } from '@d-matrix/utils';
219
220
  dom.strip('测试<em>高亮</em>测试'); // '测试高亮测试'
220
221
  ```
221
222
 
223
+ - `function convertRgbToHexInHtml(htmlStr: string): string`
224
+
225
+ 将HTML字符串中的RGB和RGBA颜色值转换为十六进制颜色值
226
+
227
+ ```ts
228
+ const html = '<div style="color: rgb(255, 0, 0)">Red text</div>';
229
+ dom.convertRgbToHexInHtml(html); // <div style="color: #ff0000">Red text</div>
230
+ ```
231
+
222
232
  ### date
223
233
 
224
234
  - `rangeOfYears(start: number, end: number = new Date().getFullYear()): number[]`