aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexlua/themes/dark.lua
diff options
context:
space:
mode:
authormitchell <unknown>2020-07-07 20:14:11 -0400
committermitchell <unknown>2020-07-07 20:14:11 -0400
commit329559b74b483576a74d5f87eebf951bd12b9200 (patch)
tree4a200348748ccfdd27d1a3f8c0352758b9f9f4c8 /lexlua/themes/dark.lua
parent5f930428f724eef7dd0be4706670039b89f3523e (diff)
downloadscintilla-mirror-329559b74b483576a74d5f87eebf951bd12b9200.tar.gz
lexlua: Added `lexer.colors` and `lexer.styles` tables for themes and lexers.
This allows for a more Lua table-oriented approach to defining and using colors and styles, instead of manually manipulating Scintilla property strings. Themes and lexers are still backwards compatible, as the underlying mechanisms are still in place.
Diffstat (limited to 'lexlua/themes/dark.lua')
-rw-r--r--lexlua/themes/dark.lua143
1 files changed, 71 insertions, 72 deletions
diff --git a/lexlua/themes/dark.lua b/lexlua/themes/dark.lua
index e187c4e7c..f0ebdf6b6 100644
--- a/lexlua/themes/dark.lua
+++ b/lexlua/themes/dark.lua
@@ -2,88 +2,87 @@
-- Dark theme for Lua lexers.
-- Contributions by Ana Balan.
-local property = require('lexer').property
+local lexer = require('lexer')
+local colors, styles = lexer.colors, lexer.styles
-- Greyscale colors.
---property['color.dark_black'] = '#000000'
-property['color.black'] = '#1A1A1A'
-property['color.light_black'] = '#333333'
---property['color.grey_black'] = '#4D4D4D'
-property['color.dark_grey'] = '#666666'
---property['color.grey'] = '#808080'
-property['color.light_grey'] = '#999999'
---property['color.grey_white'] = '#B3B3B3'
-property['color.dark_white'] = '#CCCCCC'
---property['color.white'] = '#E6E6E6'
---property['color.light_white'] = '#FFFFFF'
+colors.dark_black = '#000000'
+colors.black = '#1A1A1A'
+colors.light_black = '#333333'
+colors.grey_black = '#4D4D4D'
+colors.dark_grey = '#666666'
+colors.grey = '#808080'
+colors.light_grey = '#999999'
+colors.grey_white = '#B3B3B3'
+colors.dark_white = '#CCCCCC'
+colors.white = '#E6E6E6'
+colors.light_white = '#FFFFFF'
-- Dark colors.
---property['color.dark_red'] = '#661A1A'
---property['color.dark_yellow'] = '#66661A'
---property['color.dark_green'] = '#1A661A'
---property['color.dark_teal'] = '#1A6666'
---property['color.dark_purple'] = '#661A66'
---property['color.dark_orange'] = '#B3661A'
---property['color.dark_pink'] = '#B36666'
---property['color.dark_lavender'] = '#6666B3'
---property['color.dark_blue'] = '#1A66B3'
+colors.dark_red = '#661A1A'
+colors.dark_yellow = '#66661A'
+colors.dark_green = '#1A661A'
+colors.dark_teal = '#1A6666'
+colors.dark_purple = '#661A66'
+colors.dark_orange = '#B3661A'
+colors.dark_pink = '#B36666'
+colors.dark_lavender = '#6666B3'
+colors.dark_blue = '#1A66B3'
-- Normal colors.
-property['color.red'] = '#994D4D'
-property['color.yellow'] = '#99994D'
-property['color.green'] = '#4D994D'
-property['color.teal'] = '#4D9999'
-property['color.purple'] = '#994D99'
-property['color.orange'] = '#E6994D'
---property['color.pink'] = '#E69999'
-property['color.lavender'] = '#9999E6'
-property['color.blue'] = '#4D99E6'
+colors.red = '#994D4D'
+colors.yellow = '#99994D'
+colors.green = '#4D994D'
+colors.teal = '#4D9999'
+colors.purple = '#994D99'
+colors.orange = '#E6994D'
+colors.pink = '#E69999'
+colors.lavender = '#9999E6'
+colors.blue = '#4D99E6'
-- Light colors.
-property['color.light_red'] = '#CC8080'
-property['color.light_yellow'] = '#CCCC80'
-property['color.light_green'] = '#80CC80'
---property['color.light_teal'] = '#80CCCC'
---property['color.light_purple'] = '#CC80CC'
---property['color.light_orange'] = '#FFCC80'
---property['color.light_pink'] = '#FFCCCC'
---property['color.light_lavender'] = '#CCCCFF'
-property['color.light_blue'] = '#80CCFF'
+colors.light_red = '#CC8080'
+colors.light_yellow = '#CCCC80'
+colors.light_green = '#80CC80'
+colors.light_teal = '#80CCCC'
+colors.light_purple = '#CC80CC'
+colors.light_orange = '#FFCC80'
+colors.light_pink = '#FFCCCC'
+colors.light_lavender = '#CCCCFF'
+colors.light_blue = '#80CCFF'
--- Default style.
-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'
-end
+-- Default font.
+local font = WIN32 and 'Courier New' or OSX and 'Monaco' or
+ 'Bitstream Vera Sans Mono'
+local size = not OSX and 10 or 12
-- Predefined styles.
-property['style.default'] = 'font:$(font),size:$(fontsize),'..
- 'fore:$(color.light_grey),back:$(color.black)'
-property['style.linenumber'] = 'fore:$(color.dark_grey),back:$(color.black)'
-property['style.bracelight'] = 'fore:$(color.light_blue)'
-property['style.bracebad'] = 'fore:$(color.light_red)'
-property['style.controlchar'] = ''
-property['style.indentguide'] = 'fore:$(color.light_black)'
-property['style.calltip'] = 'fore:$(color.light_grey),back:$(color.light_black)'
-property['style.folddisplaytext'] = 'fore:$(color.dark_grey)'
+styles.default = {
+ font = font, size = size, fore = colors.light_grey, back = colors.black
+}
+styles.line_number = {fore = colors.grey, back = colors.black}
+styles.brace_light = {fore = colors.light_blue}
+styles.brace_bad = {fore = colors.light_red}
+styles.control_char = {}
+styles.indent_guide = {fore = colors.light_black}
+styles.call_tip = {fore = colors.light_grey, back = colors.light_black}
+styles.fold_display_text = {fore = colors.dark_grey}
-- Token styles.
-property['style.class'] = 'fore:$(color.light_yellow)'
-property['style.comment'] = 'fore:$(color.dark_grey)'
-property['style.constant'] = 'fore:$(color.red)'
-property['style.embedded'] = '$(style.keyword),back:$(color.light_black)'
-property['style.error'] = 'fore:$(color.red),italics'
-property['style.function'] = 'fore:$(color.blue)'
-property['style.identifier'] = ''
-property['style.keyword'] = 'fore:$(color.dark_white)'
-property['style.label'] = 'fore:$(color.orange)'
-property['style.number'] = 'fore:$(color.teal)'
-property['style.operator'] = 'fore:$(color.yellow)'
-property['style.preprocessor'] = 'fore:$(color.purple)'
-property['style.regex'] = 'fore:$(color.light_green)'
-property['style.string'] = 'fore:$(color.green)'
-property['style.type'] = 'fore:$(color.lavender)'
-property['style.variable'] = 'fore:$(color.light_blue)'
-property['style.whitespace'] = ''
+styles.class = {fore = colors.light_yellow}
+styles.comment = {fore = colors.dark_grey}
+styles.constant = {fore = colors.red}
+styles.embedded = {fore = colors.dark_white, back = colors.light_black}
+styles.error = {fore = colors.red, italics = true}
+styles['function'] = {fore = colors.blue}
+styles.identifier = {}
+styles.keyword = {fore = colors.dark_white}
+styles.label = {fore = colors.orange}
+styles.number = {fore = colors.teal}
+styles.operator = {fore = colors.yellow}
+styles.preprocessor = {fore = colors.purple}
+styles.regex = {fore = colors.light_green}
+styles.string = {fore = colors.green}
+styles.type = {fore = colors.lavender}
+styles.variable = {fore = colors.light_blue}
+styles.whitespace = {}