MCPcopy Create free account
hub / github.com/material-shell/material-shell / cssHexString

Function cssHexString

src/prefs/prefs.ts:23–47  ·  view source on GitHub ↗
(css: string)

Source from the content-addressed store, hash-verified

21}
22
23function cssHexString(css: string) {
24 let rrggbb = '#';
25 let start: number | undefined = undefined;
26 for (let loop = 0; loop < 3; loop++) {
27 let end = 0;
28 let xx = '';
29 for (let loop = 0; loop < 2; loop++) {
30 for (;;) {
31 const x = css.slice(end, end + 1);
32 if (x == '(' || x == ',' || x == ')') break;
33 end++;
34 }
35 if (loop == 0) {
36 end++;
37 start = end;
38 }
39 }
40 assert(start !== undefined, 'true by construction');
41 xx = parseInt(css.slice(start, end)).toString(16);
42 if (xx.length == 1) xx = `0${xx}`;
43 rrggbb += xx;
44 css = css.slice(end);
45 }
46 return rrggbb;
47}
48
49function getDefaultLayoutComboBox(
50 tilingLayouts: string[],

Callers 1

addSettingMethod · 0.85

Calls 2

assertFunction · 0.90
toStringMethod · 0.45

Tested by

no test coverage detected