azure-boards-ui 2.167.21 → 2.167.30
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.
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export declare const COLOR_TRANSPARENT = "transparent";
|
|
2
2
|
export declare const COLOR_WHITE = "ffffff";
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Parse color to format #aabbcc
|
|
5
|
+
* @param rawColor Raw string for color
|
|
6
|
+
* @param defaultColor will be changed to default one if rawColor is not fulfilled
|
|
7
|
+
* @param alphaRequired Color has alpha and don't need to remove it in result
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseColor(rawColor: string, alphaRequired?: boolean, defaultColor?: string): string;
|
|
4
10
|
/**
|
|
5
11
|
* Convert a hex color to numeric r g b value
|
|
6
12
|
* @param color Color in format #aabbcc
|
package/Common/ColorUtilities.js
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
export var COLOR_TRANSPARENT = "transparent";
|
|
2
2
|
export var COLOR_WHITE = "ffffff";
|
|
3
3
|
var hexColorMatcher = /^[0-9a-fA-F]+$/;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Parse color to format #aabbcc
|
|
6
|
+
* @param rawColor Raw string for color
|
|
7
|
+
* @param defaultColor will be changed to default one if rawColor is not fulfilled
|
|
8
|
+
* @param alphaRequired Color has alpha and don't need to remove it in result
|
|
9
|
+
*/
|
|
10
|
+
export function parseColor(rawColor, alphaRequired, defaultColor) {
|
|
11
|
+
if (alphaRequired === void 0) { alphaRequired = false; }
|
|
5
12
|
if (defaultColor === void 0) { defaultColor = COLOR_WHITE; }
|
|
6
13
|
if (!rawColor) {
|
|
7
14
|
rawColor = defaultColor;
|
|
8
15
|
}
|
|
9
|
-
// CSS allows colors to look like #rgb, #rgba, #rrggbb
|
|
10
|
-
if ((rawColor.length === 3 || rawColor.length === 4 || rawColor.length === 6
|
|
16
|
+
// CSS allows colors to look like #rgb, #rgba, #rrggbb
|
|
17
|
+
if ((rawColor.length === 3 || rawColor.length === 4 || rawColor.length === 6) && hexColorMatcher.test(rawColor)) {
|
|
11
18
|
rawColor = "#" + rawColor;
|
|
12
19
|
}
|
|
20
|
+
// fix for bug 1889619
|
|
21
|
+
// looking for #argb color
|
|
22
|
+
if (rawColor.length === 8 && hexColorMatcher.test(rawColor)) {
|
|
23
|
+
if (alphaRequired) {
|
|
24
|
+
rawColor = "#" + rawColor;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// remove transparency
|
|
28
|
+
rawColor = "#" + rawColor.substring(rawColor.length - 6);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
13
31
|
return rawColor;
|
|
14
32
|
}
|
|
15
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var COLOR_TRANSPARENT="transparent";export var COLOR_WHITE="ffffff";var hexColorMatcher=/^[0-9a-fA-F]+$/;export function parseColor(r,t){return void 0===t&&(t=COLOR_WHITE),r||(r=
|
|
1
|
+
export var COLOR_TRANSPARENT="transparent";export var COLOR_WHITE="ffffff";var hexColorMatcher=/^[0-9a-fA-F]+$/;export function parseColor(r,t,e){return void 0===t&&(t=!1),void 0===e&&(e=COLOR_WHITE),r||(r=e),3!==r.length&&4!==r.length&&6!==r.length||!hexColorMatcher.test(r)||(r="#"+r),8===r.length&&hexColorMatcher.test(r)&&(r=t?"#"+r:"#"+r.substring(r.length-6)),r};export function hexToRgb(r){if(7!==r.length||"#"!==r[0])throw new Error("Expected color in format #aabbcc");return[parseInt(r.substr(1,2),16),parseInt(r.substr(3,2),16),parseInt(r.substr(5,2),16)]};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-boards-ui",
|
|
3
|
-
"version": "2.167.
|
|
3
|
+
"version": "2.167.30",
|
|
4
4
|
"description": "React components for building web UI in Azure Boards",
|
|
5
5
|
"author": "Microsoft Corporation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"url": "https://github.com/Microsoft/azure-devops-ui"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"azure-devops-ui": "2.167.
|
|
12
|
+
"azure-devops-ui": "2.167.30",
|
|
13
13
|
"tslib": "~1.10.0"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|