Skip to content

Commit 80ff164

Browse files
committed
Prefix alll css vars to avoid global name conflics
Prefix alll css variables with klaro-ui to avoid name conflicts with similarly named global css vars defined in site.
1 parent b41a2c5 commit 80ff164

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

css/base.css

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
@import '../node_modules/modern-normalize/modern-normalize.css';
22

33
:root {
4-
--color-blue: oklch(from steelblue calc(l - 16%) c h);
5-
--color-gold: oklch(from orange l c calc(h + 10));
6-
--color-tan: oklch(from antiquewhite l calc(c - 0.025) h);
7-
--color-black-blue: oklch(from steelblue calc(l - 35%) calc(c - 0.05) h);
8-
--color-light-blue: oklch(from deepskyblue calc(l - 5%) c h);
4+
--klaro-ui-color-blue: oklch(from steelblue calc(l - 16%) c h);
5+
--klaro-ui-color-gold: oklch(from orange l c calc(h + 10));
6+
--klaro-ui-color-tan: oklch(from antiquewhite l calc(c - 0.025) h);
7+
--klaro-ui-color-black-blue: oklch(from steelblue calc(l - 35%) calc(c - 0.05) h);
8+
--klaro-ui-color-light-blue: oklch(from deepskyblue calc(l - 5%) c h);
99
}
1010

1111
/***** Klaro cookie notice CSS classes with custom styles *****/
@@ -14,23 +14,23 @@
1414

1515
.cookie-notice {
1616
/* Colors for light theme (default) */
17-
--modal-bg: var(--color-tan);
18-
--main-text: black;
19-
--link-text: var(--color-blue);
20-
--button-success-bg: var(--color-blue);
21-
--button-success-text: white;
17+
--klaro-ui-modal-bg: var(--klaro-ui-color-tan);
18+
--klaro-ui-main-text: black;
19+
--klaro-ui-link-text: var(--klaro-ui-color-blue);
20+
--klaro-ui-button-success-bg: var(--klaro-ui-color-blue);
21+
--klaro-ui-button-success-text: white;
2222

2323
position: fixed;
2424
inset: auto 0 0;
2525
z-index: 999;
26-
background-color: var(--modal-bg);
26+
background-color: var(--klaro-ui-modal-bg);
2727
}
2828

2929
/* Text */
3030

3131
.cn-body {
3232
padding: 1.5rem;
33-
color: var(--main-text);
33+
color: var(--klaro-ui-main-text);
3434

3535
h1 {
3636
margin: unset;
@@ -45,7 +45,7 @@
4545
}
4646

4747
a {
48-
color: var(--link-text);
48+
color: var(--klaro-ui-link-text);
4949
text-decoration: underline;
5050
}
5151

@@ -80,15 +80,15 @@
8080
/* Individual buttons */
8181

8282
.cm-btn-danger {
83-
border: 1px solid var(--main-text);
83+
border: 1px solid var(--klaro-ui-main-text);
8484
background-color: transparent;
85-
color: var(--main-text);
85+
color: var(--klaro-ui-main-text);
8686
}
8787

8888
.cm-btn-success {
89-
border: 1px solid var(--button-success-bg);
90-
background-color: var(--button-success-bg);
91-
color: var(--button-success-text);
89+
border: 1px solid var(--klaro-ui-button-success-bg);
90+
background-color: var(--klaro-ui-button-success-bg);
91+
color: var(--klaro-ui-button-success-text);
9292
}
9393

9494
@media (width >= 64rem) {

css/klaro-ui-dark.css

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
@import 'base.css';
44

55
.cookie-notice {
6-
--modal-bg: var(--color-black-blue);
7-
--main-text: white;
8-
--link-text: var(--color-light-blue);
9-
--button-success-bg: var(--color-gold);
10-
--button-success-text: black;
6+
--klaro-ui-modal-bg: var(--klaro-ui-color-black-blue);
7+
--klaro-ui-main-text: white;
8+
--klaro-ui-link-text: var(--klaro-ui-color-light-blue);
9+
--klaro-ui-button-success-bg: var(--klaro-ui-color-gold);
10+
--klaro-ui-button-success-text: black;
1111
}

css/klaro-ui.css

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
@media (prefers-color-scheme: dark) {
66
.cookie-notice {
7-
--modal-bg: var(--color-black-blue);
8-
--main-text: white;
9-
--link-text: var(--color-light-blue);
10-
--button-success-bg: var(--color-gold);
11-
--button-success-text: black;
7+
--klaro-ui-modal-bg: var(--klaro-ui-color-black-blue);
8+
--klaro-ui-main-text: white;
9+
--klaro-ui-link-text: var(--klaro-ui-color-light-blue);
10+
--klaro-ui-button-success-bg: var(--klaro-ui-color-gold);
11+
--klaro-ui-button-success-text: black;
1212
}
1313
}

0 commit comments

Comments
 (0)