Skip to content

Commit aba5c87

Browse files
committed
Optional theme for thumbnails if hlThumbTheme is set
1 parent 252425d commit aba5c87

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ Setting the color style (default is `edit-xcode`, see [all available themes](htt
2828

2929
defaults write org.n8gray.QLColorCode hlTheme ide-xcode
3030

31+
Setting the thumbnail color style (deactivated by default):
32+
33+
defaults write org.n8gray.QLColorCode hlThumbTheme ide-xcode
34+
3135
Setting the maximum size (in bytes, deactivated by default) for previewed files:
3236

3337
defaults write org.n8gray.QLColorCode maxFileSize 1000000

src/Common.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,23 @@
7777
#endif
7878
@"10", @"fontSizePoints",
7979
@"Menlo", @"font",
80-
@"edit-xcode", @"hlTheme",
80+
@"edit-xcode", @"hlTheme",
8181
// @"-lz -j 3 -t 4 --kw-case=capitalize ", @"extraHLFlags",
8282
@"-t 4 --kw-case=capitalize ", @"extraHLFlags",
8383
@"/opt/local/bin/highlight", @"pathHL",
8484
@"", @"maxFileSize",
8585
@"UTF-8", @"textEncoding",
8686
@"UTF-8", @"webkitTextEncoding", nil]];
87+
8788
[env addEntriesFromDictionary:[defaults persistentDomainForName:myDomain]];
8889

90+
// This overrides hlTheme if hlThumbTheme is set and we're generating a thumbnail
91+
// (This way we won't irritate people with existing installs)
92+
// Admittedly, it's a little shady, overriding the set value, but I'd rather complicate the compiled code
93+
if (thumbnail && [[env allKeys] containsObject:@"hlThumbTheme"]) {
94+
[env setObject:[env objectForKey:@"hlThumbTheme"] forKey:@"hlTheme"];
95+
}
96+
8997
NSString *cmd = [NSString stringWithFormat:
9098
@"'%@/colorize.sh' '%@' '%@' %s",
9199
rsrcEsc, rsrcEsc, [targetEsc stringByReplacingOccurrencesOfString:@"'" withString:@"'\\''"], thumbnail ? "1" : "0"];

0 commit comments

Comments
 (0)