aboutsummaryrefslogtreecommitdiffhomepage
path: root/themes/term.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-07-07 21:02:07 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-07-07 21:02:07 -0400
commit584e580c2213f91a17425be10d57aa5bd2f3d509 (patch)
treef47ca2ee2a85bcfba437ddd989b27284827c542c /themes/term.lua
parent021866de868fd074526fc63270639ec2f3ce9aa5 (diff)
Added `lexer.colors` and `lexer.styles` and updated themes to utilize them.
This allows for a more Lua table-oriented approach to defining and using colors and styles, instead of manually manipulating Scintilla property strings. Themes are still backwards compatible, as the underlying mechanisms are still in place.
Diffstat (limited to 'themes/term.lua')
-rw-r--r--themes/term.lua112
1 files changed, 54 insertions, 58 deletions
diff --git a/themes/term.lua b/themes/term.lua
index 53783e69..ec2fd53a 100644
--- a/themes/term.lua
+++ b/themes/term.lua
@@ -2,58 +2,57 @@
-- Terminal theme for Textadept.
-- Contributions by Ana Balan.
-local view = view
-local property, property_int = view.property, view.property_int
+local view, colors, styles = view, lexer.colors, lexer.styles
-- Normal colors.
-property['color.black'] = 0x000000
-property['color.red'] = 0x000080
-property['color.green'] = 0x008000
-property['color.yellow'] = 0x008080
-property['color.blue'] = 0x800000
-property['color.magenta'] = 0x800080
-property['color.cyan'] = 0x808000
-property['color.white'] = 0xC0C0C0
+colors.black = 0x000000
+colors.red = 0x000080
+colors.green = 0x008000
+colors.yellow = 0x008080
+colors.blue = 0x800000
+colors.magenta = 0x800080
+colors.cyan = 0x808000
+colors.white = 0xC0C0C0
-- Light colors. (16 color terminals only.)
-- These only apply to 16 color terminals. For other terminals, set the
-- style's `bold` attribute to use the light color variant.
-property['color.light_black'] = 0x404040
-property['color.light_red'] = 0x0000FF
-property['color.light_green'] = 0x00FF00
-property['color.light_yellow'] = 0x00FFFF
-property['color.light_blue'] = 0xFF0000
-property['color.light_magenta'] = 0xFF00FF
-property['color.light_cyan'] = 0xFFFF00
-property['color.light_white'] = 0xFFFFFF
+colors.light_black = 0x404040
+colors.light_red = 0x0000FF
+colors.light_green = 0x00FF00
+colors.light_yellow = 0x00FFFF
+colors.light_blue = 0xFF0000
+colors.light_magenta = 0xFF00FF
+colors.light_cyan = 0xFFFF00
+colors.light_white = 0xFFFFFF
-- Predefined styles.
-property['style.default'] = 'fore:$(color.white),back:$(color.black)'
-property['style.linenumber'] = 'fore:$(color.black),bold'
-property['style.bracelight'] = 'fore:$(color.black),back:$(color.white)'
---property['style.controlchar'] =
---property['style.indentguide'] =
-property['style.calltip'] = '$(style.default)'
-property['style.folddisplaytext'] = 'fore:$(color.black),bold'
+styles.default = {fore = colors.white, back = colors.black}
+styles.line_number = {fore = colors.black, bold = true}
+styles.brace_light = {fore = colors.black, back = colors.white}
+--styles.control_char =
+--styles.indent_guide =
+--styles.call_tip =
+styles.fold_display_text = {fore = colors.black, bold = true}
-- Token styles.
-property['style.class'] = 'fore:$(color.yellow)'
-property['style.comment'] = 'fore:$(color.black),bold'
-property['style.constant'] = 'fore:$(color.red)'
-property['style.embedded'] = '$(style.keyword),back:$(color.black)'
-property['style.error'] = 'fore:$(color.red),bold'
-property['style.function'] = 'fore:$(color.blue)'
-property['style.identifier'] = ''
-property['style.keyword'] = 'fore:$(color.white),bold'
-property['style.label'] = 'fore:$(color.red),bold'
-property['style.number'] = 'fore:$(color.cyan)'
-property['style.operator'] = 'fore:$(color.yellow)'
-property['style.preprocessor'] = 'fore:$(color.magenta)'
-property['style.regex'] = 'fore:$(color.green),bold'
-property['style.string'] = 'fore:$(color.green)'
-property['style.type'] = 'fore:$(color.magenta),bold'
-property['style.variable'] = 'fore:$(color.blue),bold'
-property['style.whitespace'] = ''
+styles.class = {fore = colors.yellow}
+styles.comment = {fore = colors.black, bold = true}
+styles.constant = {fore = colors.red}
+styles.embedded = {fore = colors.white, bold = true, back = colors.black}
+styles.error = {fore = colors.red, bold = true}
+styles['function'] = {fore = colors.blue}
+styles.identifier = {}
+styles.keyword = {fore = colors.white, bold = true}
+styles.label = {fore = colors.red, bold = true}
+styles.number = {fore = colors.cyan}
+styles.operator = {fore = colors.yellow}
+styles.preprocessor = {fore = colors.magenta}
+styles.regex = {fore = colors.green, bold = true}
+styles.string = {fore = colors.green}
+styles.type = {fore = colors.magenta, bold = true}
+styles.variable = {fore = colors.blue, bold = true}
+styles.whitespace = {}
-- Multiple Selection and Virtual Space
--view.additional_sel_fore =
@@ -61,30 +60,27 @@ property['style.whitespace'] = ''
--view.additional_caret_fore =
-- Caret and Selection Styles.
---view:set_sel_fore(true, property_int['color.white'])
---view:set_sel_back(true, property_int['color.black'])
---view.caret_fore = property_int['color.black']
+--view:set_sel_fore(true, colors.white)
+--view:set_sel_back(true, colors.black)
+--view.caret_fore = colors.black
--view.caret_line_back =
-- Fold Margin.
---view:set_fold_margin_color(true, property_int['color.white'])
---view:set_fold_margin_hi_color(true, property_int['color.white'])
+--view:set_fold_margin_color(true, colors.white)
+--view:set_fold_margin_hi_color(true, colors.white)
-- Markers.
-local MARK_BOOKMARK = textadept.bookmarks.MARK_BOOKMARK
-view.marker_back[MARK_BOOKMARK] = property_int['color.blue']
-view.marker_back[textadept.run.MARK_WARNING] = property_int['color.yellow']
-view.marker_back[textadept.run.MARK_ERROR] = property_int['color.red']
+view.marker_back[textadept.bookmarks.MARK_BOOKMARK] = colors.blue
+view.marker_back[textadept.run.MARK_WARNING] = colors.yellow
+view.marker_back[textadept.run.MARK_ERROR] = colors.red
-- Indicators.
-view.indic_fore[ui.find.INDIC_FIND] = property_int['color.yellow']
-local INDIC_HIGHLIGHT = textadept.editing.INDIC_HIGHLIGHT
-view.indic_fore[INDIC_HIGHLIGHT] = property_int['color.yellow']
-local INDIC_PLACEHOLDER = textadept.snippets.INDIC_PLACEHOLDER
-view.indic_fore[INDIC_PLACEHOLDER] = property_int['color.magenta']
+view.indic_fore[ui.find.INDIC_FIND] = colors.yellow
+view.indic_fore[textadept.editing.INDIC_HIGHLIGHT] = colors.yellow
+view.indic_fore[textadept.snippets.INDIC_PLACEHOLDER] = colors.magenta
-- Call tips.
-view.call_tip_fore_hlt = property_int['color.blue']
+view.call_tip_fore_hlt = colors.blue
-- Long Lines.
-view.edge_color = property_int['color.red']
+view.edge_color = colors.red