@abtnode/auth 1.16.15-beta-12f50442 → 1.16.15-beta-d649cecc

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.
@@ -13,6 +13,14 @@ const getPassportColor = (preferredColor, did) => {
13
13
  return color;
14
14
  };
15
15
 
16
+ const getTextColor = (background) => {
17
+ const r = parseInt(background.slice(1, 3), 16);
18
+ const g = parseInt(background.slice(3, 5), 16);
19
+ const b = parseInt(background.slice(5, 7), 16);
20
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
21
+ return luminance > 0.5 ? '#111' : '#EEE';
22
+ };
23
+
16
24
  /**
17
25
  * Generate Passport SVG
18
26
  *
@@ -87,3 +95,4 @@ const createPassportSvg = ({
87
95
 
88
96
  module.exports = createPassportSvg;
89
97
  module.exports.getPassportColor = getPassportColor;
98
+ module.exports.getTextColor = getTextColor;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.15-beta-12f50442",
6
+ "version": "1.16.15-beta-d649cecc",
7
7
  "description": "Simple lib to manage auth in ABT Node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -20,14 +20,14 @@
20
20
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@abtnode/constant": "1.16.15-beta-12f50442",
24
- "@abtnode/logger": "1.16.15-beta-12f50442",
25
- "@abtnode/util": "1.16.15-beta-12f50442",
23
+ "@abtnode/constant": "1.16.15-beta-d649cecc",
24
+ "@abtnode/logger": "1.16.15-beta-d649cecc",
25
+ "@abtnode/util": "1.16.15-beta-d649cecc",
26
26
  "@arcblock/did": "1.18.89",
27
27
  "@arcblock/nft-display": "2.7.9",
28
28
  "@arcblock/vc": "1.18.89",
29
- "@blocklet/constant": "1.16.15-beta-12f50442",
30
- "@blocklet/meta": "1.16.15-beta-12f50442",
29
+ "@blocklet/constant": "1.16.15-beta-d649cecc",
30
+ "@blocklet/meta": "1.16.15-beta-d649cecc",
31
31
  "@ocap/mcrypto": "1.18.89",
32
32
  "@ocap/util": "1.18.89",
33
33
  "@ocap/wallet": "1.18.89",
@@ -43,5 +43,5 @@
43
43
  "devDependencies": {
44
44
  "jest": "^27.5.1"
45
45
  },
46
- "gitHead": "48bda4b29eb31a70e0eb9cab0bce6e544960c7fd"
46
+ "gitHead": "56941d1056a9e5f189992ace6e93971aa4226d07"
47
47
  }