Skip to content

Commit 260e4d7

Browse files
tanhauhauPuruVJ
andauthored
feat(repl): allow dark mode for svelte-json-tree (#517)
* feat(repl): allow dark mode for svelte-json-tree * feat(repl): use theme to control svelte-json-tree color * Add changeset --------- Co-authored-by: Puru Vijay <[email protected]>
1 parent 4971be8 commit 260e4d7

File tree

5 files changed

+34
-7
lines changed

5 files changed

+34
-7
lines changed

.changeset/clever-pumas-fly.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/repl': patch
3+
---
4+
5+
(feat) allow dark mode for svelte-json-tree

packages/repl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@
8484
"estree-walker": "^3.0.3",
8585
"marked": "^5.1.0",
8686
"resolve.exports": "^2.0.2",
87-
"svelte-json-tree": "^1.0.0"
87+
"svelte-json-tree": "^2.0.0"
8888
}
8989
}

packages/repl/src/lib/Output/Viewer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
</div>
256256
257257
<section slot="panel-body">
258-
<Console {logs} on:clear={clear_logs} />
258+
<Console {logs} {theme} on:clear={clear_logs} />
259259
</section>
260260
</PaneWithPanel>
261261

packages/repl/src/lib/Output/console/Console.svelte

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
44
/** @type {import('./console').Log[]} */
55
export let logs;
6+
7+
/** @type {'light' | 'dark'} */
8+
export let theme;
69
</script>
710

8-
<div class="container">
11+
<div class="container" class:dark={theme === 'dark'}>
912
{#each logs as log}
1013
<ConsoleLine {log} />
1114
{/each}
@@ -15,4 +18,19 @@
1518
.container {
1619
--json-tree-string-color: var(--sk-code-string);
1720
}
21+
.dark {
22+
--json-tree-property-color: #72a2d3;
23+
--json-tree-string-color: #6cd1c7;
24+
--json-tree-symbol-color: #6cd1c7;
25+
--json-tree-boolean-color: #9681f7;
26+
--json-tree-function-color: #e59b6f;
27+
--json-tree-number-color: #9681f7;
28+
--json-tree-label-color: #9ca0a5;
29+
--json-tree-arrow-color: #e8eaed;
30+
--json-tree-null-color: #81868a;
31+
--json-tree-undefined-color: #81868a;
32+
--json-tree-date-color: #9ca0a5;
33+
--json-tree-operator-color: #e8eaed;
34+
--json-tree-regex-color: #6cd1c7;
35+
}
1836
</style>

pnpm-lock.yaml

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)