Skip to content

Commit ab316dc

Browse files
committed
make editor theable
1 parent 3e6f1ac commit ab316dc

File tree

3 files changed

+63
-26
lines changed

3 files changed

+63
-26
lines changed

src/components/editor.js

+59-24
Original file line numberDiff line numberDiff line change
@@ -342,35 +342,70 @@ class AppEditor extends Tonic {
342342
success: rgbaToHex(styles.getPropertyValue('--tonic-success').trim())
343343
}
344344

345+
346+
const userColors = this.props.parent.state.settings?.userColors ?? []
347+
345348
const base = `vs${theme.includes('dark') ? '-dark' : ''}`
346349
monaco.editor.defineTheme(theme, {
347350
base,
348351
inherit: true,
349352
rules: [
350-
{
351-
token: 'identifier',
352-
foreground: colors.primary
353-
},
354-
{
355-
token: 'comment',
356-
foreground: colors.info
357-
},
358-
{
359-
token: 'keyword',
360-
foreground: colors.accent
361-
},
362-
{
363-
token: 'string',
364-
foreground: colors.info
365-
},
366-
{
367-
token: 'number',
368-
foreground: colors.accent
369-
},
370-
{
371-
token: 'punctuation',
372-
foreground: colors.primary
373-
}
353+
{ token: 'identifier', foreground: colors.primary },
354+
{ token: 'keyword', foreground: colors.accent },
355+
{ token: 'punctuation', foreground: colors.primary },
356+
357+
{ token: '', foreground: 'D4D4D4', background: '1E1E1E' },
358+
{ token: 'invalid', foreground: 'f44747' },
359+
{ token: 'emphasis', fontStyle: 'italic' },
360+
{ token: 'strong', fontStyle: 'bold' },
361+
362+
{ token: 'variable', foreground: '74B0DF' },
363+
{ token: 'variable.predefined', foreground: '4864AA' },
364+
{ token: 'variable.parameter', foreground: '9CDCFE' },
365+
{ token: 'constant', foreground: '569CD6' },
366+
{ token: 'comment', foreground: colors.info },
367+
{ token: 'number', foreground: colors.accent },
368+
{ token: 'number.hex', foreground: '5BB498' },
369+
{ token: 'regexp', foreground: 'B46695' },
370+
{ token: 'annotation', foreground: 'cc6666' },
371+
{ token: 'type', foreground: '3DC9B0' },
372+
373+
{ token: 'delimiter', foreground: 'DCDCDC' },
374+
{ token: 'delimiter.html', foreground: '808080' },
375+
{ token: 'delimiter.xml', foreground: '808080' },
376+
377+
{ token: 'tag', foreground: '569CD6' },
378+
{ token: 'meta.scss', foreground: 'A79873' },
379+
{ token: 'meta.tag', foreground: 'CE9178' },
380+
{ token: 'metatag', foreground: 'DD6A6F' },
381+
{ token: 'metatag.content.html', foreground: '9CDCFE' },
382+
{ token: 'metatag.html', foreground: '569CD6' },
383+
{ token: 'metatag.xml', foreground: '569CD6' },
384+
{ token: 'metatag.php', fontStyle: 'bold' },
385+
386+
{ token: 'key', foreground: colors.info },
387+
{ token: 'string.key.json', foreground: colors.info },
388+
{ token: 'string.value.json', foreground: colors.primary },
389+
390+
{ token: 'attribute.name', foreground: colors.info },
391+
{ token: 'attribute.value', foreground: colors.primary },
392+
{ token: 'attribute.value.number.css', foreground: colors.accent },
393+
{ token: 'attribute.value.unit.css', foreground: colors.accent },
394+
{ token: 'attribute.value.hex.css', foreground: colors.accent },
395+
396+
{ token: 'string', foreground: colors.primary },
397+
{ token: 'string.sql', foreground: 'FF0000' },
398+
399+
{ token: 'keyword', foreground: colors.accent },
400+
{ token: 'keyword.flow', foreground: 'C586C0' },
401+
{ token: 'keyword.json', foreground: 'CE9178' },
402+
{ token: 'keyword.flow.scss', foreground: '569CD6' },
403+
404+
{ token: 'operator.scss', foreground: '909090' },
405+
{ token: 'operator.sql', foreground: '778899' },
406+
{ token: 'operator.swift', foreground: '909090' },
407+
{ token: 'predefined.sql', foreground: 'FF00FF' },
408+
...userColors
374409
],
375410
colors: {
376411
'editor.background': colors.background

src/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,6 @@ class AppView extends Tonic {
276276
for (const [projectId, project] of dataProjects.entries()) {
277277
if (socket.subclusters.get(project.subclusterId)) continue
278278

279-
console.log('REBINDING', project)
280-
281279
const subcluster = await socket.subcluster({ sharedKey: project.sharedKey })
282280

283281
subcluster.on('patch', async (value, packet) => {

src/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
".c": "cpp",
1414
".js": "javascript"
1515
},
16+
"colors": [
17+
{ "token": "string.key.json", "foreground": "A31515" },
18+
{ "token": "string.value.json", "foreground": "0451A5" }
19+
],
1620
"previewMode": false,
1721
"rootFile": "src/index.html",
1822
"previewWindows": [

0 commit comments

Comments
 (0)