Skip to content

Commit 8acf43a

Browse files
committed
Refactor fallback colouring
1 parent 338ade7 commit 8acf43a

File tree

4 files changed

+62
-28
lines changed

4 files changed

+62
-28
lines changed

Mariana.sublime-color-scheme

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// https://www.sublimetext.com/docs/color_schemes.html
33
// https://www.sublimetext.com/docs/scope_naming.html
44

5-
// The naming pattern of the scopes is this:
6-
// [conventional_scheme].klog.[klog_scheme]
7-
// The first part serves as a fallback, so that there
8-
// is at least *some* colouring.
9-
105
"variables": {},
116
"globals": {},
127
"rules": [
@@ -15,33 +10,33 @@
1510
"foreground": "#ffffff",
1611
},
1712
{
18-
"scope": "constant.language.klog.date",
13+
"scope": "meta.klog.date",
1914
"foreground": "#ffffff",
20-
"font_style": "underline"
15+
"font_style": "underline",
2116
},
2217
{
23-
"scope": "variable.klog.should_total",
18+
"scope": "meta.klog.should_total",
2419
"foreground": "#ef7af5",
2520
},
2621
{
27-
"scope": "comment.klog.summary.text",
22+
"scope": "meta.klog.summary.text",
2823
"foreground": "#aaaaaa",
2924
},
3025
{
31-
"scope": "comment.klog.summary.tag",
26+
"scope": "meta.klog.summary.tag",
3227
"foreground": "#c9c9c9",
33-
"font_style": "italic"
28+
"font_style": "italic",
3429
},
3530
{
36-
"scope": "constant.numeric.klog.duration.positive",
37-
"foreground": "#91f578",
31+
"scope": "meta.klog.duration.positive",
32+
"foreground": "#8ce675",
3833
},
3934
{
40-
"scope": "keyword.control.klog.duration.negative",
35+
"scope": "meta.klog.duration.negative",
4136
"foreground": "#f58078",
4237
},
4338
{
44-
"scope": "string.quoted.klog.range",
39+
"scope": "meta.klog.range",
4540
"foreground": "#86c8f7",
4641
},
4742
]

Monokai.sublime-color-scheme

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
// https://www.sublimetext.com/docs/color_schemes.html
3+
// https://www.sublimetext.com/docs/scope_naming.html
4+
5+
"variables": {},
6+
"globals": {},
7+
"rules": [
8+
{
9+
"scope": "source.klog",
10+
"foreground": "#ffffff",
11+
},
12+
{
13+
"scope": "meta.klog.date",
14+
"foreground": "#ffffff",
15+
"font_style": "underline",
16+
},
17+
{
18+
"scope": "meta.klog.should_total",
19+
"foreground": "#ef7af5",
20+
},
21+
{
22+
"scope": "meta.klog.summary.text",
23+
"foreground": "#aaaaaa",
24+
},
25+
{
26+
"scope": "meta.klog.summary.tag",
27+
"foreground": "#c9c9c9",
28+
"font_style": "italic",
29+
},
30+
{
31+
"scope": "meta.klog.duration.positive",
32+
"foreground": "#8ce675",
33+
},
34+
{
35+
"scope": "meta.klog.duration.negative",
36+
"foreground": "#f58078",
37+
},
38+
{
39+
"scope": "meta.klog.range",
40+
"foreground": "#86c8f7",
41+
},
42+
]
43+
}

klog.sublime-settings

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{
2-
// Enforce Mariana scheme, since colors have special
3-
// meaning in klog, so we can’t use the general-purpose ones.
4-
"color_scheme": "Mariana.sublime-color-scheme",
5-
62
// Disable indentation-related features.
73
"smart_indent": false,
84

klog.sublime-syntax

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ contexts:
2323
record:
2424
# A record must start with a date.
2525
- match: '^({{date}})'
26-
scope: constant.language.klog.date
26+
scope: constant.language meta.klog.date
2727
push:
2828

2929
# Then, there may follow a should total on the same line.
3030
- match: '(\s+{{should_total}})?\s*'
31-
scope: variable.klog.should_total
31+
scope: variable.function meta.klog.should_total
3232

3333
- match: '.*'
3434
scope: invalid
@@ -45,7 +45,7 @@ contexts:
4545
# A record summary line cannot start with whitespace.
4646
- match: '^(?=[^\s])'
4747
push:
48-
- meta_scope: comment.klog.summary.text
48+
- meta_scope: comment meta.klog.summary.text
4949
- include: tag
5050
- match: '^(?=\s)'
5151
pop: 1
@@ -69,16 +69,16 @@ contexts:
6969
- match: '^{{indentation}}'
7070
push:
7171
- match: '{{duration_positive}}'
72-
scope: constant.numeric.klog.duration.positive
72+
scope: constant.numeric meta.klog.duration.positive
7373
push: entry_summary
7474
- match: '{{duration_negative}}'
75-
scope: keyword.control.klog.duration.negative
75+
scope: keyword.control meta.klog.duration.negative
7676
push: entry_summary
7777
- match: '{{range}}'
78-
scope: string.quoted.klog.range.closed
78+
scope: string.quoted meta.klog.range.closed
7979
push: entry_summary
8080
- match: '{{open_range}}'
81-
scope: string.quoted.klog.range.open
81+
scope: string.quoted meta.klog.range.open
8282
push: entry_summary
8383

8484
# Exit on blank line.
@@ -93,7 +93,7 @@ contexts:
9393
# Parse the remainder of the first line, and continue on the next.
9494
- match: '(?=\s|$)'
9595
push:
96-
- meta_scope: comment.klog.summary.text
96+
- meta_scope: comment meta.klog.summary.text
9797
- include: tag
9898

9999
# Exit on blank line.
@@ -114,4 +114,4 @@ contexts:
114114

115115
tag:
116116
- match: '\#[\p{L}\d_]+'
117-
scope: comment.klog.summary.tag
117+
scope: comment meta.klog.summary.tag

0 commit comments

Comments
 (0)