You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-11
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,9 @@ An easy way for electron apps to add app badges to the taskbar to indicate notif
21
21
• Made the color 100% accurate, no longer an estimation! \
22
22
• Now compatible with automatically set colors! \
23
23
• Automatically changes color when the system accent color changes! \
24
-
• Added RGB support!\
25
-
• Fixed typescript support!\
26
-
• And more bug fixes!
24
+
• Added RGB support \
25
+
• Fixed typescript support \
26
+
• And more bug fixes
27
27
28
28
---
29
29
@@ -39,7 +39,7 @@ npm i electron-taskbar-badge
39
39
40
40
> ⚠ **This library is ONLY compatible with node version 14 and above! Only supports Windows at the moment**
41
41
42
-
First you must import the library using the following code:
42
+
First, you must import the library using the following code:
43
43
```javascript
44
44
constBadge=require('electron-taskbar-badge');
45
45
// or `import * as Badge from 'electron-taskbar-badge';` for ESM users
@@ -51,7 +51,7 @@ For basic usage, all you have to do is call the function with the options:
51
51
constBadge=require('electron-taskbar-badge');
52
52
// or `import * as Badge from 'electron-taskbar-badge';` for ESM users
53
53
54
-
// NOTE: Although the font size 62px seems large, it is not. It is relative the the radius. Lowering both of these values can decrease quality significantly. Increasing them can reduce performance. Leave the font size as is for basic usage
54
+
// NOTE: Although the font size 62px seems large, it is not. It is relative to the radius. Lowering both of these values can decrease quality significantly. Increasing them can reduce performance. Leave the font size and the radius as is for basic usage
55
55
constbadgeOptions= {
56
56
fontColor:'#FFFFFF', // The font color
57
57
font:'62px Microsoft Yahei', // The font and its size. You shouldn't have to change this at all
@@ -61,7 +61,7 @@ const badgeOptions = {
61
61
badgeDescription:'Unread Notifications', // The badge description
62
62
invokeType:'handle', // The IPC event type
63
63
max:9, // The maximum integer allowed for the badge. Anything above this will have "+" added to the end of it.
64
-
fit:false, // Useful for multi-digit numbers. For single digit keep this set to false
64
+
fit:false, // Useful for multi-digit numbers. For single digits keep this set to false
65
65
additionalFunc: (count) => {
66
66
// An additional function to run whenever the IPC event fires. It has a count parameter which is the number that the badge was set to.
67
67
console.log(`Received ${count} new notifications!`);
If you want your badge's font color to be automatically chosen, simply set `fontColor` to `auto`. This will chose the font color between black or white, whichever looks best. Here's an example:
119
+
If you want your badge's font color to be automatically chosen, simply set `fontColor` to `auto`. This will choose the font color between black or white, whichever looks best. Here's an example:
120
120
121
121
```javascript
122
122
constbadgeOptions= {
@@ -142,15 +142,15 @@ new Badge(win, badgeOptions);
|`fontColor`| string (required) | The font color in hex or rgb color format. Pretty selfexplanatory. | auto |
145
+
|`fontColor`| string (required) | The font color in hex or RGB color format. Pretty self-explanatory. | auto |
146
146
|`font`| string | The font for the badge icon. The format is [size]px [Font family name]**ALWAYS SET THE FONT SIZE TO 62px FOR BEST QUALITY**| 62px Microsoft Yahei |
147
-
|`color`| string (required) | The background color for the badge icon in hex or rgb color format. |`null`|
147
+
|`color`| string (required) | The background color for the badge icon in hex or RGB color format. |`null`|
148
148
|`radius`| number | The radius for the badge icon **ALWAYS SET TO 48 FOR BEST QUALITY**| 48 |
149
149
|`updateBadgeEvent`| string (required) | The IPC event name to listen on |`null`|
150
150
|`badgeDescription`| string | A description that will be provided to Accessibility screen readers |`this.updateBadgeEvent`|
151
151
|`invokeType`| string | The IPC event type. Can be `send` or `handle`. | send |
152
152
|`max`| number | The maximum integer allowed for the badge. Anything above this will have "+" added to the end of it. | 99 |
153
-
|`fit`| boolean | Automatically sizes large numbers to fit in the badge icon. Set to true only for large 3digit numbers (including the "+"!) |`false`|
153
+
|`fit`| boolean | Automatically sizes large numbers to fit in the badge icon. Set to true only for large 3-digit numbers (including the "+"!) |`false`|
154
154
|`useSystemAccentTheme`| boolean | Whether to use the system accent color for the background color. fontColor and color will be overridden. It would be automatically chosen between black or white, whichever looks best. |`false`|
155
155
|`additionalFunc`| function(count) | An additional function to run whenever the IPC event fires. It has a count parameter which is the number that the badge was set to. |`null`|
0 commit comments