Skip to content

Instantly share code, notes, and snippets.

@prateekrajgautam
Created October 2, 2023 14:07
Show Gist options
  • Save prateekrajgautam/589ff43cdd58b0b38affb688893dc863 to your computer and use it in GitHub Desktop.
Save prateekrajgautam/589ff43cdd58b0b38affb688893dc863 to your computer and use it in GitHub Desktop.
Texworks Darkmode color config
# location ~/.TeXworks/configuration/syntax-patterns.txt
# TeXworks: Patterns for syntax coloring
# Each entry consists of three whitespace-separated fields:
# <style> <spell?> <regex>
# <style> is a combination of color and style flags
# Valid syntax:
# <fgcolor>
# <fgcolor>/<bgcolor>
# ;<fontflags>
# <fgcolor>;<fontflags>
# <fgcolor>/<bgcolor>;<fontflags>
#
# The color fields <fgcolor> and <bgcolor> are either:
# *) a color name from the list defined in the SVG standard;
# see http://www.w3.org/TR/SVG/types.html#ColorKeywords
# *) a hexadecimal color value of the form #rrggbb; note that if this is used at
# the beginning of a line, a space " " must be added in front of it so the
# line is not interpreted as a comment (e.g., " #aabbcc" instead of "#aabbcc")
#
# The <fontflags> field is a combination of the letters
# B (bold)
# I (italic)
# U (underlined)
# <spell> is a flag controlling whether this style is subject to spell-checking;
# "Y" or "y" for yes, "N" (or anything else, actually) for no.
# <regex> is the regular expression to match.
# Note that order of rules may be important if several rules could match at the same position;
# this is why the generic "control sequence" rule comes AFTER the specific \begin/\end one.
[LaTeX]
# special characters
#ff7c77 N [$#^_{}&]
# LaTeX environments
#7fff97 N \\(?:begin|end)\s*\{[^\}]*\}
# LaTeX packages
#678eff N \\usepackage\s*(?:\[[^\]]*\]\s*)?\{[^\}]*\}
# control sequences
#3adaff N \\(?:[A-Za-z@]+|.)
# comments
#e65777 Y %.*
[ConTeXt]
# special characters
#ff495b N [$#{}&]
# 'other' special characters
darkblue N [=\[\]]
# mathematical operations
gray N [\-+/^_]
# start/stop
#7fff97;B N \\(?:start|stop)[A-Za-z]+
# control sequences
blue;B N \\(?:[A-Za-z@]+|.)
# comments
#ff5487 Y %.*
[BibTeX]
# entries
darkgreen N @[^{]+
# comments
red Y %.*
# keys
blue N [a-zA-Z]+(?=\s*=)
[LaTeX DTX]
# comments
#e65777 Y \^\^A.*
# Guards
darkviolet N ^%<@@=[^>]*>
limegreen N ^%<\*[^>]*>
crimson N ^%</[^>]*>
brown N ^%<<
orange N ^%<[^>]*>
# special characters
darkred N \^\^\^\^\^[0-9a-z]{5}
darkred N \^\^\^\^[0-9a-z]{4}
darkred N \^\^\^[0-9a-z]{3}
darkred N \^\^[0-9a-z]{2}
darkred N [$#^_{}&]
gray N ^%%.*
gray N ^%
# Macrocode
green N \\(?:begin|end)\{macrocode\}
# LaTeX environments
darkgreen N \\(?:begin|end)\s*\{[^}]*\}
# control sequences
blue N \\(?:[A-Za-z@:_]+|.)
[Lua]
# Comments (single line only)
red Y --.*
# Strings
green N (?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))
green N \[(=*)\[[\s\S]*(?:\]\1\]|$)
# Keywords
blue;B N
\b(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b
# Numbers
darkblue N [+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))
# other possibilities to be added....
# [Metapost]
# etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment