1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-03-09 13:59:49 -04:00

Add dark theme for syntax editor

This commit is contained in:
Reinhard Pointner 2019-02-24 16:47:43 +07:00
parent e49fc7879a
commit 123d9ce859
2 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE RSyntaxTheme SYSTEM "theme.dtd">
<!-- FileBot Format Expression theme based on Notepad++'s Obsidian theme. -->
<RSyntaxTheme version="1.0">
<!-- General editor colors. -->
<background color="293134" />
<caret color="c1cbc2" />
<selection fg="default" useFG="false" bg="404E51" />
<currentLineHighlight color="2F393C" fade="false" />
<marginLine fg="394448" />
<markAllHighlight color="6b8189" />
<markOccurrencesHighlight color="5b7179" border="false" />
<matchedBracket fg="6A8088" bg="6b8189" highlightBoth="true" animate="false" />
<hyperlinks fg="a082bd" />
<secondaryLanguages>
<language index="1" bg="333344" />
</secondaryLanguages>
<!-- Gutter styling. -->
<gutterBorder color="81969A" />
<lineNumbers fg="81969A" />
<foldIndicator fg="6A8088" iconBg="2f383c" iconArmedBg="3f484c" />
<iconRowHeader activeLineRange="3399ff" />
<!-- Syntax tokens. -->
<tokenStyles>
<style token="IDENTIFIER" fg="a9b7c6" />
<style token="RESERVED_WORD" fg="93C763" bold="true" />
<style token="RESERVED_WORD_2" fg="93C763" bold="true" />
<style token="ANNOTATION" fg="E8E2B7" />
<style token="COMMENT_DOCUMENTATION" fg="6C788C" />
<style token="COMMENT_EOL" fg="66747B" />
<style token="COMMENT_MULTILINE" fg="66747B" />
<style token="COMMENT_KEYWORD" fg="ae9fbf" />
<style token="COMMENT_MARKUP" fg="ae9fbf" />
<style token="DATA_TYPE" fg="678CB1" bold="true" />
<style token="FUNCTION" fg="E0E2E4" />
<style token="LITERAL_BOOLEAN" fg="93C763" bold="true" />
<style token="LITERAL_NUMBER_DECIMAL_INT" fg="FFCD22" />
<style token="LITERAL_NUMBER_FLOAT" fg="FFCD22" />
<style token="LITERAL_NUMBER_HEXADECIMAL" fg="FFCD22" />
<style token="LITERAL_STRING_DOUBLE_QUOTE" fg="EC7600" />
<style token="LITERAL_CHAR" fg="EC7600" />
<style token="LITERAL_BACKQUOTE" fg="EC7600" />
<style token="MARKUP_TAG_DELIMITER" fg="678CB1" />
<style token="MARKUP_TAG_NAME" fg="ABBFD3" bold="true" />
<style token="MARKUP_TAG_ATTRIBUTE" fg="B3B689" />
<style token="MARKUP_TAG_ATTRIBUTE_VALUE" fg="e1e2cf" />
<style token="MARKUP_COMMENT" fg="66747B" />
<style token="MARKUP_DTD" fg="A082BD" />
<style token="MARKUP_PROCESSING_INSTRUCTION" fg="A082BD" />
<style token="MARKUP_CDATA" fg="d5e6f0" />
<style token="MARKUP_CDATA_DELIMITER" fg="ae9fbf" />
<style token="MARKUP_ENTITY_REFERENCE" fg="678CB1" />
<style token="OPERATOR" fg="E8E2B7" />
<style token="PREPROCESSOR" fg="A082BD" />
<style token="REGEX" fg="d39745" />
<style token="SEPARATOR" fg="E8E2B7" />
<style token="VARIABLE" fg="ae9fbf" bold="true" />
<style token="WHITESPACE" fg="E0E2E4" />
<style token="ERROR_IDENTIFIER" fg="ff0000" />
<style token="ERROR_NUMBER_FORMAT" fg="ff0000" />
<style token="ERROR_STRING_DOUBLE" fg="ff0000" />
<style token="ERROR_CHAR" fg="ff0000" />
</tokenStyles>
</RSyntaxTheme>

View File

@ -2,9 +2,11 @@ package net.filebot.ui.rename;
import static java.awt.Font.*;
import static net.filebot.Logging.*;
import static net.filebot.ui.ThemeSupport.*;
import static net.filebot.util.ui.SwingUI.*;
import java.awt.Font;
import java.io.InputStream;
import java.util.function.Consumer;
import java.util.logging.Level;
@ -26,7 +28,7 @@ public class FormatExpressionTextArea extends RSyntaxTextArea {
super(syntaxDocument, "", 1, 80);
try {
Theme.load(FormatExpressionTextArea.class.getResourceAsStream("FormatExpressionTextArea.Theme.xml")).apply(this);
Theme.load(openTheme()).apply(this);
} catch (Exception e) {
debug.log(Level.WARNING, e, e::toString);
}
@ -59,6 +61,14 @@ public class FormatExpressionTextArea extends RSyntaxTextArea {
}));
}
protected InputStream openTheme() {
if (getTheme().isDark()) {
return FormatExpressionTextArea.class.getResourceAsStream("FormatExpressionTextArea.Theme.Dark.xml");
} else {
return FormatExpressionTextArea.class.getResourceAsStream("FormatExpressionTextArea.Theme.xml");
}
}
public void onChange(Consumer<DocumentEvent> handler) {
getDocument().addDocumentListener(new LazyDocumentListener(handler));
}