Skip to content

Commit 4439df6

Browse files
authored
fix(css-variables): add root selector without classname (#5513)
* fix(css-variables): add root selector without classname Need to add the `:root` in addition to `:root.classname` for some use cases, when we do not need to add the class in html tag for sites that does not have multiple themes * fix: changeset
1 parent 5e6716e commit 4439df6

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

.changeset/dirty-numbers-doubt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ultraviolet/themes": minor
3+
---
4+
5+
add simple root selector for generated css

packages/themes/public/style/dark.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
:root,
12
:root.dark-theme {
23
--color-danger-background: #4e0921;
34
--color-danger-background-disabled: #47081e;

packages/themes/public/style/darker.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
:root,
12
:root.darker-theme {
23
--color-danger-background: #2e0514;
34
--color-danger-background-disabled: #20040e;

packages/themes/public/style/light.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
:root,
12
:root.light-theme {
23
--color-danger-background: #ffebf2;
34
--color-danger-background-disabled: #fff3f7;

utils/scripts/create-css-variables.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export const generateThemeCss = ({
6969
uvTheme: UvThemeType
7070
filename: string
7171
}) =>
72-
`:root.${filename}-theme {\n${
72+
`:root,\n:root.${filename}-theme {\n${
7373
createCssVariables('color', uvTheme.colors) +
7474
createCssVariables('radius', uvTheme.radii) +
7575
createCssVariables('shadow', uvTheme.shadows) +

0 commit comments

Comments
 (0)