sk-clib 1.10.0 → 1.12.0
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.
package/dist/styles.css
CHANGED
|
@@ -478,6 +478,9 @@
|
|
|
478
478
|
}
|
|
479
479
|
@layer utilities;
|
|
480
480
|
@layer utilities {
|
|
481
|
+
.bg-seed > * {
|
|
482
|
+
color: var(--color-on-primary);
|
|
483
|
+
}
|
|
481
484
|
.bg-background > * {
|
|
482
485
|
color: var(--color-on-background);
|
|
483
486
|
}
|
|
@@ -528,6 +531,12 @@
|
|
|
528
531
|
}
|
|
529
532
|
}
|
|
530
533
|
@layer utilities {
|
|
534
|
+
.bg-seed {
|
|
535
|
+
background: var(--color-seed);
|
|
536
|
+
}
|
|
537
|
+
.bg-on-seed {
|
|
538
|
+
background: var(--color-on-primary);
|
|
539
|
+
}
|
|
531
540
|
.bg-primary {
|
|
532
541
|
background: var(--color-primary);
|
|
533
542
|
}
|
package/dist/theme/logic.js
CHANGED
|
@@ -30,6 +30,7 @@ export function build(seedHex, mode, variant, contrast) {
|
|
|
30
30
|
}
|
|
31
31
|
export function applyScheme(scheme) {
|
|
32
32
|
var map = {
|
|
33
|
+
"--color-seed": scheme.sourceColorArgb,
|
|
33
34
|
"--color-primary": scheme.primary,
|
|
34
35
|
"--color-on-primary": scheme.onPrimary,
|
|
35
36
|
"--color-primary-container": scheme.primaryContainer,
|
|
@@ -15,6 +15,15 @@
|
|
|
15
15
|
}
|
|
16
16
|
}: Props = $props();
|
|
17
17
|
|
|
18
|
+
onMount(() => {
|
|
19
|
+
const colorSeed = document.documentElement.style.getPropertyValue("--color-seed")
|
|
20
|
+
if (colorSeed) {
|
|
21
|
+
theme.seedColor = colorSeed
|
|
22
|
+
} else {
|
|
23
|
+
theme.seedColor = defaults.defaultSeedColor
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
18
27
|
/**
|
|
19
28
|
* Checks if the user already has a set md-theme
|
|
20
29
|
*/
|
|
@@ -41,14 +50,10 @@
|
|
|
41
50
|
|
|
42
51
|
// Build the theme with material utilities
|
|
43
52
|
const built = build(theme.seedColor, theme.mode, theme.variant);
|
|
44
|
-
|
|
53
|
+
|
|
45
54
|
// Create css variables object and save to body
|
|
46
55
|
let applied = applyScheme(built);
|
|
47
56
|
|
|
48
|
-
// Inject Seed Color
|
|
49
|
-
applied["--color-primary-fallback"] = applied["--color-primary"]
|
|
50
|
-
applied["--color-primary"] = theme.seedColor
|
|
51
|
-
|
|
52
57
|
// Save the theme to the user's cookies
|
|
53
58
|
saveTheme(applied);
|
|
54
59
|
});
|
|
@@ -72,12 +77,10 @@
|
|
|
72
77
|
*/
|
|
73
78
|
function applyTheme(theme) {
|
|
74
79
|
if (theme === undefined) {
|
|
75
|
-
console.warn('No theme specified, defaulting to doing nothing');
|
|
76
80
|
return;
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
for (const [name, hex] of Object.entries(theme)) {
|
|
80
|
-
console.info(`Setting ${name} to ${hex}`);
|
|
81
84
|
document.documentElement.style.setProperty(name, hex);
|
|
82
85
|
}
|
|
83
86
|
}
|