Skip to content

Commit

Permalink
TTCN theme
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Mar 22, 2023
1 parent b088d98 commit acf053b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions website/src/js/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {defaultKeymap, history, historyKeymap, indentWithTab} from '@codemirror/
import {closeBrackets, closeBracketsKeymap} from '@codemirror/autocomplete'
import {php} from '@codemirror/lang-php'
import { PHPStanError } from './PHPStanError';
import { ttcn } from './ttcn-theme';

const buildErrorLines = (doc: Text, lines: number[]) => {
const errorLineDecoration = Decoration.line({class: 'bg-red-200/50 hover:bg-red-300/50'});
Expand Down Expand Up @@ -140,6 +141,7 @@ ko.bindingHandlers.codeMirror = {
}),
errorLines,
hover,
ttcn,
],
})

Expand Down
52 changes: 52 additions & 0 deletions website/src/js/ttcn-theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import {HighlightStyle, syntaxHighlighting} from '@codemirror/language'
import {tags as t} from '@lezer/highlight'

export const ttcnHighlightStyle = HighlightStyle.define([
{tag: t.quote,
color: '#090'},
{tag: t.deleted,
color: '#d44'},
{tag: t.inserted,
color: '#292'},
{tag: t.strong,
fontWeight: 'bold'},
{tag: t.emphasis,
fontStyle: 'italic'},
{tag: t.link,
color: '#00c',
textDecoration: 'underline'},
{tag: t.strikethrough,
textDecoration: 'line-through'},
{tag: t.heading,
fontWeight: 'bold',
color: '#00f'},

{tag: t.atom,
color: '#219'},
{tag: t.attributeName,
color: '#00c'},
{tag: t.comment,
color: '#333'},
{tag: [t.definition(t.variableName), t.className],
color: '#00f'},
{tag: t.invalid,
color: '#f00'},
{tag: t.keyword,
fontWeight: 'bold'},
{tag: t.meta,
color: '#555'},
{tag: t.string,
color: '#060'},
{tag: [t.special(t.string), t.escape, t.character],
color: '#f50'},
{tag: t.tagName,
color: '#170'},
{tag: t.variableName,
color: '#05a'},
{tag: [t.function(t.variableName), t.special(t.variableName), t.local(t.variableName), t.typeName],
color: '#8b2252'},
{tag: [t.self, t.labelName],
color: '#085'}
])

export const ttcn = syntaxHighlighting(ttcnHighlightStyle);

0 comments on commit acf053b

Please sign in to comment.