-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.mjs
43 lines (32 loc) · 893 Bytes
/
helpers.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { readFileSync } from 'node:fs';
function makeSVGOneLine(SVGPath) {
try {
const source = readFileSync(SVGPath, 'utf-8');
const oneLineSVG = source.replaceAll(' ', '').replaceAll('\n', '');
return oneLineSVG;
} catch (e) {
console.error(e);
}
}
function makeEmojiCSSVariable(name, SVGPath) {
return `--${name}: '${SVGPath}';\n`;
}
/**************************
For example, add the output of this to :root in `callout-emojis.css`:
```
console.log(
makeEmojiCSSVariable(
'unicorn', makeSVGOneLine('/path/to/unicorn.svg')
)
);
```
Then add these lines to `callout-emojis.css`:
```
.callout[data-callout="unicorn"] {
--callout-color: <your-prefered-color-rgb>;
--callout-icon: var(--unicorn);
}
```
And you're good to go!
Note that `unicorn` already exists, you can find more emojis at: https://openmoji.org/library/
***************************/