@magic-xpa/angular 4.801.0-dev481.297 → 4.801.0-dev481.298
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.
- package/esm2020/src/services/magic-color.service.mjs +12 -4
- package/fesm2015/magic-xpa-angular.mjs +11 -3
- package/fesm2015/magic-xpa-angular.mjs.map +1 -1
- package/fesm2020/magic-xpa-angular.mjs +11 -3
- package/fesm2020/magic-xpa-angular.mjs.map +1 -1
- package/package.json +3 -3
- package/src/services/magic-color.service.d.ts +2 -1
|
@@ -2252,6 +2252,8 @@ class MagicColorService {
|
|
|
2252
2252
|
constructor(http) {
|
|
2253
2253
|
this.http = http;
|
|
2254
2254
|
this.colorFilePath = 'assets/clr_rnt.eng';
|
|
2255
|
+
}
|
|
2256
|
+
getColorData() {
|
|
2255
2257
|
this.http.get(this.colorFilePath, { responseType: 'text' }).subscribe(resp => {
|
|
2256
2258
|
this.colorsData = resp.replace(/\n/g, '@').split('@');
|
|
2257
2259
|
});
|
|
@@ -2271,24 +2273,30 @@ class MagicColorService {
|
|
|
2271
2273
|
return 'rgba(' + rgb.red + ',' + rgb.green + ',' + rgb.blue + ',' + rgb.alpha + ')';
|
|
2272
2274
|
}
|
|
2273
2275
|
getColor(colorIndex, colorType) {
|
|
2274
|
-
if (this.colorsData
|
|
2276
|
+
if (!this.colorsData)
|
|
2277
|
+
this.getColorData();
|
|
2278
|
+
if (this.colorsData && this.colorsData[colorIndex - 1]) {
|
|
2275
2279
|
let hex = '';
|
|
2276
2280
|
const grayHashCode = '00808080';
|
|
2277
2281
|
let color = this.colorsData[colorIndex].split(',');
|
|
2278
2282
|
if (+color[3] <= 1) {
|
|
2279
2283
|
switch (colorType) {
|
|
2280
2284
|
case MAGIC_FG_COLOR:
|
|
2281
|
-
hex = (
|
|
2285
|
+
hex = (color[1]);
|
|
2282
2286
|
break;
|
|
2283
2287
|
case MAGIC_BG_COLOR:
|
|
2284
|
-
hex = (
|
|
2288
|
+
hex = (color[2]);
|
|
2285
2289
|
break;
|
|
2290
|
+
default:
|
|
2291
|
+
console.log('Please enter valid color type : 1-FG, 2-BG ' + colorIndex);
|
|
2292
|
+
return '';
|
|
2286
2293
|
}
|
|
2287
2294
|
}
|
|
2288
2295
|
else
|
|
2289
2296
|
hex = grayHashCode;
|
|
2290
2297
|
return this.hexToRgba('#' + hex);
|
|
2291
2298
|
}
|
|
2299
|
+
console.log('Could not get color for number ' + colorIndex);
|
|
2292
2300
|
return '';
|
|
2293
2301
|
}
|
|
2294
2302
|
}
|