Skip to content

Commit 928568e

Browse files
authored
Merge pull request #6 from DioxusLabs/fix-theme
Fix default cursor theme
2 parents 943a56b + 58dd775 commit 928568e

5 files changed

Lines changed: 36 additions & 19 deletions

File tree

assets/generated/arborium-themes/dioxus-code-theme.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
.dxc,
1414
.dxc-editor {
1515
background: var(--dxc-light-on, var(--dxc-light-background,)) var(--dxc-dark-on, var(--dxc-dark-background,));
16-
--bg: var(--dxc-light-on, var(--dxc-light-var-bg,)) var(--dxc-dark-on, var(--dxc-dark-var-bg,));
17-
--surface: var(--dxc-light-on, var(--dxc-light-var-surface,)) var(--dxc-dark-on, var(--dxc-dark-var-surface,));
16+
--dxc-bg: var(--dxc-light-on, var(--dxc-light-var-bg,)) var(--dxc-dark-on, var(--dxc-dark-var-bg,));
17+
--dxc-surface: var(--dxc-light-on, var(--dxc-light-var-surface,)) var(--dxc-dark-on, var(--dxc-dark-var-surface,));
1818
color: var(--dxc-light-on, var(--dxc-light-color,)) var(--dxc-dark-on, var(--dxc-dark-color,));
19-
--fg: var(--dxc-light-on, var(--dxc-light-var-fg,)) var(--dxc-dark-on, var(--dxc-dark-var-fg,));
20-
--accent: var(--dxc-light-on, var(--dxc-light-var-accent,)) var(--dxc-dark-on, var(--dxc-dark-var-accent,));
21-
--muted: var(--dxc-light-on, var(--dxc-light-var-muted,)) var(--dxc-dark-on, var(--dxc-dark-var-muted,));
19+
--dxc-fg: var(--dxc-light-on, var(--dxc-light-var-fg,)) var(--dxc-dark-on, var(--dxc-dark-var-fg,));
20+
--dxc-accent: var(--dxc-light-on, var(--dxc-light-var-accent,)) var(--dxc-dark-on, var(--dxc-dark-var-accent,));
21+
--dxc-muted: var(--dxc-light-on, var(--dxc-light-var-muted,)) var(--dxc-dark-on, var(--dxc-dark-var-muted,));
2222
}
2323
.dxc .a-at,
2424
.dxc-editor .a-at {

build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,12 @@ fn shared_theme_css(rules: &SharedRules) -> String {
282282
css.push_str(".dxc,\n.dxc-editor {\n");
283283
for property in &rules.base {
284284
let variable = base_variable_suffix(property);
285-
writeln!(css, " {property}: {};", active_value(&variable)).unwrap();
285+
if let Some(custom_property) = property.strip_prefix("--") {
286+
let namespaced_property = format!("--dxc-{}", css_identifier(custom_property));
287+
writeln!(css, " {namespaced_property}: {};", active_value(&variable)).unwrap();
288+
} else {
289+
writeln!(css, " {property}: {};", active_value(&variable)).unwrap();
290+
}
286291
}
287292
css.push_str("}\n");
288293

code-editor/assets/demo.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,3 @@ h1 {
3939
padding: 5px 8px;
4040
text-transform: uppercase;
4141
}
42-
43-
.dxc-editor {
44-
--dxc-editor-caret: #e8eef7;
45-
--dxc-editor-focus-ring: 0 0 0 3px rgba(122, 162, 247, 0.22);
46-
}

code-editor/assets/dioxus-code-editor.css

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
.dxc-editor-gutter {
4444
background: inherit;
45-
color: var(--muted, currentColor);
45+
color: var(--dxc-muted, currentColor);
4646
left: 0;
4747
padding: var(--dxc-editor-gutter-padding, 14px 0);
4848
pointer-events: none;
@@ -64,7 +64,7 @@
6464
.dxc-editor-input {
6565
background: transparent;
6666
border: 0;
67-
caret-color: var(--dxc-editor-caret, currentColor);
67+
caret-color: var(--dxc-editor-caret, var(--dxc-fg, CanvasText));
6868
color: transparent;
6969
display: block;
7070
font: inherit;
@@ -83,23 +83,42 @@
8383
}
8484

8585
.dxc-editor-input::selection {
86-
background: var(--dxc-editor-selection, rgba(122, 162, 247, 0.34));
86+
background: var(--dxc-editor-selection);
8787
color: transparent;
8888
}
8989

9090
.dxc-editor-input:empty::before {
91-
color: var(--muted, currentColor);
91+
color: var(--dxc-muted, currentColor);
9292
content: attr(data-placeholder);
9393
opacity: 0.72;
9494
}
9595

9696
.dxc-editor-input::placeholder {
97-
color: var(--muted, currentColor);
97+
color: var(--dxc-muted, currentColor);
9898
opacity: 0.72;
9999
}
100100

101101
.dxc-editor:focus-within {
102-
box-shadow: var(--dxc-editor-focus-ring, 0 0 0 3px rgba(122, 162, 247, 0.22));
102+
box-shadow: var(--dxc-editor-focus-ring, none);
103+
}
104+
105+
@supports (color: color-mix(in srgb, white 50%, transparent)) {
106+
.dxc-editor-gutter {
107+
color: var(--dxc-muted, color-mix(in srgb, var(--dxc-fg, currentColor) 62%, transparent));
108+
}
109+
110+
.dxc-editor-input::selection {
111+
background: var(--dxc-editor-selection, color-mix(in srgb, var(--dxc-accent, Highlight) 34%, transparent));
112+
}
113+
114+
.dxc-editor-input:empty::before,
115+
.dxc-editor-input::placeholder {
116+
color: var(--dxc-muted, color-mix(in srgb, var(--dxc-fg, currentColor) 62%, transparent));
117+
}
118+
119+
.dxc-editor:focus-within {
120+
box-shadow: var(--dxc-editor-focus-ring, 0 0 0 3px color-mix(in srgb, var(--dxc-accent, Highlight) 22%, transparent));
121+
}
103122
}
104123

105124
.dxc-editor-line,

examples/editor/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ body {
217217
}
218218
219219
.example-editor {
220-
--dxc-editor-caret: #e8eef7;
221-
--dxc-editor-focus-ring: 0 0 0 3px rgba(122, 162, 247, 0.22);
222220
min-height: 0;
223221
}
224222
"#;

0 commit comments

Comments
 (0)