@xort/cga 0.0.80 → 0.0.81

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.
@@ -99,6 +99,12 @@ var Color = /** @class */ (function (_super) {
99
99
  else if (typeof value === 'number') {
100
100
  this.setHex(value);
101
101
  }
102
+ if (typeof value === 'string') {
103
+ if (value.indexOf("#") === 0)
104
+ this.setHexCssString(value);
105
+ else
106
+ console.error("未匹配的颜色数据");
107
+ }
102
108
  return this;
103
109
  };
104
110
  Color.prototype.setHex = function (hex) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xort/cga",
3
- "version": "0.0.80",
3
+ "version": "0.0.81",
4
4
  "description": "Xtor Compute Geometry Algorithm Libary 计算几何算法库",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/math/Color.ts CHANGED
@@ -70,6 +70,12 @@ export class Color extends EventHandler {
70
70
  } else if (typeof value === 'number') {
71
71
  this.setHex(value);
72
72
  }
73
+ if (typeof value === 'string') {
74
+ if (value.indexOf("#") === 0)
75
+ this.setHexCssString(value);
76
+ else
77
+ console.error("未匹配的颜色数据")
78
+ }
73
79
 
74
80
  return this;
75
81
  }