Skip to content

Commit 77fc3eb

Browse files
committed
Remove included colour overrides
1 parent 0b30abb commit 77fc3eb

File tree

5 files changed

+56
-97
lines changed

5 files changed

+56
-97
lines changed

Mariana.sublime-color-scheme

Lines changed: 0 additions & 39 deletions
This file was deleted.

Monokai.sublime-color-scheme

Lines changed: 0 additions & 39 deletions
This file was deleted.

README.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,36 @@
11
# klog for Sublime Text
22

3-
This package provides support for working with [klog time tracking](https://klog.jotaen.net) files in the Sublime Text editor:
3+
This package provides support for working with [klog time tracking](https://klog.jotaen.net) files in the Sublime Text editor.
4+
5+
![A klog file with sample data](resources/example.png)
46

57
- Syntax highlighting
6-
+ If you use the Mariana or Monokai theme, it also assigns meaningful colouring.
78
- Smart completion for inserting the current date or time. For example:
89
+ Typing `today` completes to the current date
910
+ Typing `now` completes to the current time
1011
- A few sensible default settings for the `.klg` file format
1112

12-
![A klog file with sample data](resources/example.png)
13+
## Configuration
14+
15+
### Colour overrides
16+
17+
The pre-defined syntax highlighting should look meaningful in most available colour schemes.
18+
19+
For klog-specific customisations, you can specify the following colour overrides:
20+
21+
- `markup.other.date.klog` For the date, e.g. `2022-03-15`
22+
- `markup.other.should_total.klog` For the should total, e.g. `(8h!)`
23+
- `markup.other.summary.klog` For summary text
24+
- `markup.other.summary.tag.klog` For tags inside summaries, e.g. `#work`
25+
- `markup.other.duration_positive.klog` For positive durations, e.g. `5h25m`
26+
- `markup.other.duration_negative.klog` For negative durations, e.g. `-15m`
27+
- `markup.other.range.klog` For ranges, e.g. `8:00 - 9:20`
28+
- `markup.other.open_range.klog` For open ranges, e.g. `14:30 - ?`
29+
30+
You can achieve this by adding entries ([see Sublime docs](https://www.sublimetext.com/docs/color_schemes.html)) to the `rules` list of your scheme’s customisation file:
31+
32+
```
33+
"rules": [
34+
{"scope": "markup.other.range.klog", "foreground": "#76c7ff"},
35+
]
36+
```

klog.sublime-syntax

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,27 @@ variables:
1919
indentation: '(\t| | | )'
2020

2121
contexts:
22+
23+
# For every scope, there must be two values assigned:
24+
# - One klog-specific scope, that’s unused by this
25+
# package, but that allows the user to setup overrides
26+
# conveniently.
27+
# - One generic fallback scope, that will likely work
28+
# out of the box for most color schemes.
29+
2230
main:
2331
- include: record
2432

2533
record:
2634
# A record must start with a date.
2735
- match: '^({{date}})'
28-
scope: constant.language.klog entity.other.date.klog
36+
scope: markup.underline.klog markup.other.date.klog
2937
push:
3038

3139
# Then, there may follow a should total on the same line.
32-
- match: '(\s+{{should_total}})?\s*'
33-
scope: variable.function.klog entity.other.should_total.klog
40+
- match: '(\s+({{should_total}}))?\s*'
41+
captures:
42+
2: constant.numeric.klog markup.other.should_total.klog
3443

3544
# End of headline.
3645
- match: '$'
@@ -44,7 +53,7 @@ contexts:
4453
# A record summary line cannot start with whitespace.
4554
- match: '^(?=[^\s])'
4655
push:
47-
- meta_scope: comment.klog entity.other.summary.text.klog
56+
- meta_scope: comment.klog markup.other.summary.klog
4857
- include: tag
4958
- match: '^(?=\s)'
5059
pop: 1
@@ -65,17 +74,21 @@ contexts:
6574
pop: 99999
6675

6776
# When the line is indented, it’s an entry.
68-
- match: '^{{indentation}}{{duration_positive}}(?=\s|$)'
69-
scope: constant.numeric.klog entity.other.duration.positive.klog
77+
- match: '^{{indentation}}({{duration_positive}})(?=\s|$)'
78+
captures:
79+
2: markup.inserted.klog markup.other.duration_positive.klog
7080
push: entry_summary
71-
- match: '^{{indentation}}{{duration_negative}}(?=\s|$)'
72-
scope: keyword.control.klog entity.other.duration.negative.klog
81+
- match: '^{{indentation}}({{duration_negative}})(?=\s|$)'
82+
captures:
83+
2: markup.deleted.klog markup.other.duration_negative.klog
7384
push: entry_summary
74-
- match: '^{{indentation}}{{range}}(?=\s|$)'
75-
scope: string.quoted.klog entity.other.range.closed.klog
85+
- match: '^{{indentation}}({{range}})(?=\s|$)'
86+
captures:
87+
2: variable.function.klog markup.other.range.klog
7688
push: entry_summary
77-
- match: '^{{indentation}}{{open_range}}(?=\s|$)'
78-
scope: string.quoted.klog entity.other.range.open.klog
89+
- match: '^{{indentation}}({{open_range}})(?=\s|$)'
90+
captures:
91+
2: variable.function.klog markup.other.open_range.klog
7992
push: entry_summary
8093

8194
# Error if next line doesn’t start with whitespace.
@@ -85,7 +98,7 @@ contexts:
8598

8699
entry_summary:
87100
# Parse the remainder of the first line, and continue on the next.
88-
- meta_scope: comment.klog entity.other.summary.text.klog
101+
- meta_scope: comment.klog markup.other.summary.klog
89102
- include: tag
90103

91104
# Exit on blank line.
@@ -106,4 +119,4 @@ contexts:
106119

107120
tag:
108121
- match: '\#[\p{L}\d_]+'
109-
scope: comment.klog entity.other.summary.tag.klog
122+
scope: string.quoted markup.other.summary.tag.klog

resources/test.klg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ This is an all-valid record. It’s indented with tabs.
1717
-1h20m
1818
-1h Test
1919
0:00 - 1:00
20-
04:00-17:00 asdf #foo_bar
21-
<4:00 - 17:00> asdf #foo #bar
20+
04:00-17:00 asdf #foo_bar?
21+
<4:00 - 17:00> asdf #foo: #bar!
2222
4:00am - 5:00pm 1:00 - 2:00
2323
4:00am-5:00pm>
2424
15:00>-? Foo

0 commit comments

Comments
 (0)