aboutsummaryrefslogtreecommitdiffhomepage
path: root/themes/light.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/light.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/light.lua')
-rw-r--r--themes/light.lua184
1 files changed, 90 insertions, 94 deletions
diff --git a/themes/light.lua b/themes/light.lua
index b0ae292b..cdaca6f6 100644
--- a/themes/light.lua
+++ b/themes/light.lua
@@ -2,90 +2,89 @@
-- Light 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
-- Greyscale colors.
-property['color.dark_black'] = 0x000000
-property['color.black'] = 0x1A1A1A
-property['color.light_black'] = 0x333333
-property['color.grey_black'] = 0x4D4D4D
-property['color.dark_grey'] = 0x666666
-property['color.grey'] = 0x808080
-property['color.light_grey'] = 0x999999
-property['color.grey_white'] = 0xB3B3B3
-property['color.dark_white'] = 0xCCCCCC
-property['color.white'] = 0xE6E6E6
-property['color.light_white'] = 0xFFFFFF
+colors.dark_black = 0x000000
+colors.black = 0x1A1A1A
+colors.light_black = 0x333333
+colors.grey_black = 0x4D4D4D
+colors.dark_grey = 0x666666
+colors.grey = 0x808080
+colors.light_grey = 0x999999
+colors.grey_white = 0xB3B3B3
+colors.dark_white = 0xCCCCCC
+colors.white = 0xE6E6E6
+colors.light_white = 0xFFFFFF
-- Dark colors.
-property['color.dark_red'] = 0x1A1A66
-property['color.dark_yellow'] = 0x1A6666
-property['color.dark_green'] = 0x1A661A
-property['color.dark_teal'] = 0x66661A
-property['color.dark_purple'] = 0x661A66
-property['color.dark_orange'] = 0x1A66B3
-property['color.dark_pink'] = 0x6666B3
-property['color.dark_lavender'] = 0xB36666
-property['color.dark_blue'] = 0xB3661A
+colors.dark_red = 0x1A1A66
+colors.dark_yellow = 0x1A6666
+colors.dark_green = 0x1A661A
+colors.dark_teal = 0x66661A
+colors.dark_purple = 0x661A66
+colors.dark_orange = 0x1A66B3
+colors.dark_pink = 0x6666B3
+colors.dark_lavender = 0xB36666
+colors.dark_blue = 0xB3661A
-- Normal colors.
-property['color.red'] = 0x4D4D99
-property['color.yellow'] = 0x4D9999
-property['color.green'] = 0x4D994D
-property['color.teal'] = 0x99994D
-property['color.purple'] = 0x994D99
-property['color.orange'] = 0x4D99E6
-property['color.pink'] = 0x9999E6
-property['color.lavender'] = 0xE69999
-property['color.blue'] = 0xE6994D
+colors.red = 0x4D4D99
+colors.yellow = 0x4D9999
+colors.green = 0x4D994D
+colors.teal = 0x99994D
+colors.purple = 0x994D99
+colors.orange = 0x4D99E6
+colors.pink = 0x9999E6
+colors.lavender = 0xE69999
+colors.blue = 0xE6994D
-- Light colors.
-property['color.light_red'] = 0x8080CC
-property['color.light_yellow'] = 0x80CCCC
-property['color.light_green'] = 0x80CC80
-property['color.light_teal'] = 0xCCCC80
-property['color.light_purple'] = 0xCC80CC
-property['color.light_orange'] = 0x80CCFF
-property['color.light_pink'] = 0xCCCCFF
-property['color.light_lavender'] = 0xFFCCCC
-property['color.light_blue'] = 0xFFCC80
+colors.light_red = 0x8080CC
+colors.light_yellow = 0x80CCCC
+colors.light_green = 0x80CC80
+colors.light_teal = 0xCCCC80
+colors.light_purple = 0xCC80CC
+colors.light_orange = 0x80CCFF
+colors.light_pink = 0xCCCCFF
+colors.light_lavender = 0xFFCCCC
+colors.light_blue = 0xFFCC80
-- Default font.
-property['font'], property['fontsize'] = 'Bitstream Vera Sans Mono', 10
-if WIN32 then
- property['font'] = 'Courier New'
-elseif OSX then
- property['font'], property['fontsize'] = 'Monaco', 12
+if not font then
+ font = WIN32 and 'Courier New' or OSX and 'Monaco' or
+ 'Bitstream Vera Sans Mono'
end
+if not size then size = not OSX and 10 or 12 end
-- Predefined styles.
-property['style.default'] = 'font:$(font),size:$(fontsize),'..
- 'fore:$(color.light_black),back:$(color.white)'
-property['style.linenumber'] = 'fore:$(color.grey),back:$(color.white)'
---property['style.controlchar'] = ''
-property['style.indentguide'] = 'fore:$(color.dark_white)'
-property['style.calltip'] = 'fore:$(color.light_black),back:$(color.dark_white)'
-property['style.folddisplaytext'] = 'fore:$(color.grey)'
+styles.default = {
+ font = font, size = size, fore = colors.light_black, back = colors.white
+}
+styles.line_number = {fore = colors.grey, back = colors.white}
+--styles.control_char = {}
+styles.indent_guide = {fore = colors.dark_white}
+styles.call_tip = {fore = colors.light_black, back = colors.dark_white}
+styles.fold_display_text = {fore = colors.grey}
-- Token styles.
-property['style.class'] = 'fore:$(color.yellow)'
-property['style.comment'] = 'fore:$(color.grey)'
-property['style.constant'] = 'fore:$(color.red)'
-property['style.embedded'] = '$(style.keyword),back:$(color.dark_white)'
-property['style.error'] = 'fore:$(color.red),italics'
-property['style.function'] = 'fore:$(color.dark_orange)'
-property['style.identifier'] = ''
-property['style.keyword'] = 'fore:$(color.dark_blue)'
-property['style.label'] = 'fore:$(color.dark_orange)'
-property['style.number'] = 'fore:$(color.teal)'
-property['style.operator'] = 'fore:$(color.purple)'
-property['style.preprocessor'] = 'fore:$(color.dark_yellow)'
-property['style.regex'] = 'fore:$(color.dark_green)'
-property['style.string'] = 'fore:$(color.green)'
-property['style.type'] = 'fore:$(color.lavender)'
-property['style.variable'] = 'fore:$(color.dark_lavender)'
-property['style.whitespace'] = ''
+styles.class = {fore = colors.yellow}
+styles.comment = {fore = colors.grey}
+styles.constant = {fore = colors.red}
+styles.embedded = {fore = colors.dark_blue, back = colors.dark_white}
+styles.error = {fore = colors.red, italics}
+styles['function'] = {fore = colors.dark_orange}
+styles.identifier = {}
+styles.keyword = {fore = colors.dark_blue}
+styles.label = {fore = colors.dark_orange}
+styles.number = {fore = colors.teal}
+styles.operator = {fore = colors.purple}
+styles.preprocessor = {fore = colors.dark_yellow}
+styles.regex = {fore = colors.dark_green}
+styles.string = {fore = colors.green}
+styles.type = {fore = colors.lavender}
+styles.variable = {fore = colors.dark_lavender}
+styles.whitespace = {}
-- Multiple Selection and Virtual Space
--view.additional_sel_alpha =
@@ -94,44 +93,41 @@ property['style.whitespace'] = ''
--view.additional_caret_fore =
-- Caret and Selection Styles.
-view:set_sel_fore(true, property_int['color.light_black'])
-view:set_sel_back(true, property_int['color.light_grey'])
+view:set_sel_fore(true, colors.light_black)
+view:set_sel_back(true, colors.light_grey)
--view.sel_alpha =
-view.caret_fore = property_int['color.grey_black']
-view.caret_line_back = property_int['color.dark_white']
+view.caret_fore = colors.grey_black
+view.caret_line_back = colors.dark_white
--view.caret_line_back_alpha =
-- 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, t_run = textadept.bookmarks.MARK_BOOKMARK, textadept.run
---view.marker_fore[MARK_BOOKMARK] = property_int['color.white']
-view.marker_back[MARK_BOOKMARK] = property_int['color.dark_blue']
---view.marker_fore[t_run.MARK_WARNING] = property_int['color.white']
-view.marker_back[t_run.MARK_WARNING] = property_int['color.light_yellow']
---view.marker_fore[t_run.MARK_ERROR] = property_int['color.white']
-view.marker_back[t_run.MARK_ERROR] = property_int['color.light_red']
+--view.marker_fore[textadept.bookmarks.MARK_BOOKMARK] = colors.white
+view.marker_back[textadept.bookmarks.MARK_BOOKMARK] = colors.dark_blue
+--view.marker_fore[textadept.run.MARK_WARNING] = colors.white
+view.marker_back[textadept.run.MARK_WARNING] = colors.light_yellow
+--view.marker_fore[textadept.run.MARK_ERROR] = colors.white
+view.marker_back[textadept.run.MARK_ERROR] = colors.light_red
for i = buffer.MARKNUM_FOLDEREND, buffer.MARKNUM_FOLDEROPEN do -- fold margin
- view.marker_fore[i] = property_int['color.white']
- view.marker_back[i] = property_int['color.grey']
- view.marker_back_selected[i] = property_int['color.grey_black']
+ view.marker_fore[i] = colors.white
+ view.marker_back[i] = colors.grey
+ view.marker_back_selected[i] = colors.grey_black
end
-- Indicators.
-view.indic_fore[ui.find.INDIC_FIND] = property_int['color.yellow']
+view.indic_fore[ui.find.INDIC_FIND] = colors.yellow
view.indic_alpha[ui.find.INDIC_FIND] = 255
-local INDIC_BRACEMATCH = textadept.editing.INDIC_BRACEMATCH
-view.indic_fore[INDIC_BRACEMATCH] = property_int['color.grey']
-local INDIC_HIGHLIGHT = textadept.editing.INDIC_HIGHLIGHT
-view.indic_fore[INDIC_HIGHLIGHT] = property_int['color.orange']
-view.indic_alpha[INDIC_HIGHLIGHT] = 255
+view.indic_fore[textadept.editing.INDIC_BRACEMATCH] = colors.grey
+view.indic_fore[textadept.editing.INDIC_HIGHLIGHT] = colors.orange
+view.indic_alpha[textadept.editing.INDIC_HIGHLIGHT] = 255
local INDIC_PLACEHOLDER = textadept.snippets.INDIC_PLACEHOLDER
-view.indic_fore[INDIC_PLACEHOLDER] = property_int['color.grey_black']
+view.indic_fore[INDIC_PLACEHOLDER] = colors.grey_black
-- Call tips.
-view.call_tip_fore_hlt = property_int['color.light_blue']
+view.call_tip_fore_hlt = colors.light_blue
-- Long Lines.
-view.edge_color = property_int['color.grey']
+view.edge_color = colors.grey