dracula.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. -- Dracula Theme for Lumacs
  2. -- Enhanced version with rich styling using all available face attributes
  3. -- Based on the official Dracula color scheme
  4. local theme = editor:create_and_register_theme("dracula")
  5. -- Dracula color palette
  6. local background = lumacs.Color(40, 42, 54) -- #282a36
  7. local current = lumacs.Color(68, 71, 90) -- #44475a
  8. local selection = lumacs.Color(68, 71, 90) -- #44475a
  9. local foreground = lumacs.Color(248, 248, 242) -- #f8f8f2
  10. local comment = lumacs.Color(98, 114, 164) -- #6272a4
  11. -- Dracula colors
  12. local cyan = lumacs.Color(139, 233, 253) -- #8be9fd
  13. local green = lumacs.Color(80, 250, 123) -- #50fa7b
  14. local orange = lumacs.Color(255, 184, 108) -- #ffb86c
  15. local pink = lumacs.Color(255, 121, 198) -- #ff79c6
  16. local purple = lumacs.Color(189, 147, 249) -- #bd93f9
  17. local red = lumacs.Color(255, 85, 85) -- #ff5555
  18. local yellow = lumacs.Color(241, 250, 140) -- #f1fa8c
  19. -- Additional colors for variety
  20. local dark_purple = lumacs.Color(139, 97, 199) -- #8b61c7
  21. local light_bg = lumacs.Color(50, 52, 64) -- #323440
  22. -- === SET ALL THEME ELEMENTS (Complete theming) ===
  23. -- Special elements (base)
  24. theme:set_color(lumacs.ThemeElement.Background, foreground, background)
  25. theme:set_color(lumacs.ThemeElement.Foreground, foreground, background)
  26. theme:set_color(lumacs.ThemeElement.Normal, foreground, background)
  27. -- Text syntax elements
  28. theme:set_color(lumacs.ThemeElement.Keyword, pink, background)
  29. theme:set_color(lumacs.ThemeElement.String, yellow, background)
  30. theme:set_color(lumacs.ThemeElement.Comment, comment, background)
  31. theme:set_color(lumacs.ThemeElement.Function, green, background)
  32. theme:set_color(lumacs.ThemeElement.Type, cyan, background)
  33. theme:set_color(lumacs.ThemeElement.Number, purple, background)
  34. theme:set_color(lumacs.ThemeElement.Constant, purple, background)
  35. theme:set_color(lumacs.ThemeElement.Variable, foreground, background)
  36. theme:set_color(lumacs.ThemeElement.Builtin, cyan, background)
  37. theme:set_color(lumacs.ThemeElement.Preprocessor, pink, background)
  38. theme:set_color(lumacs.ThemeElement.Operator, pink, background)
  39. theme:set_color(lumacs.ThemeElement.Error, foreground, red)
  40. theme:set_color(lumacs.ThemeElement.Warning, background, orange)
  41. -- UI elements
  42. theme:set_color(lumacs.ThemeElement.StatusLine, foreground, dark_purple)
  43. theme:set_color(lumacs.ThemeElement.StatusLineInactive, comment, current)
  44. theme:set_color(lumacs.ThemeElement.MessageLine, foreground, background)
  45. theme:set_color(lumacs.ThemeElement.LineNumber, comment, background)
  46. theme:set_color(lumacs.ThemeElement.LineNumberCurrent, orange, background)
  47. theme:set_color(lumacs.ThemeElement.Cursor, background, foreground)
  48. theme:set_color(lumacs.ThemeElement.Selection, foreground, selection)
  49. theme:set_color(lumacs.ThemeElement.SearchMatch, background, orange)
  50. theme:set_color(lumacs.ThemeElement.SearchFail, foreground, red)
  51. theme:set_color(lumacs.ThemeElement.MatchParen, background, cyan)
  52. -- Minibuffer elements
  53. theme:set_color(lumacs.ThemeElement.MinibufferPrompt, pink, background)
  54. theme:set_color(lumacs.ThemeElement.MinibufferInput, foreground, current)
  55. theme:set_color(lumacs.ThemeElement.MinibufferCompletion, foreground, current)
  56. theme:set_color(lumacs.ThemeElement.MinibufferMatch, background, purple)
  57. -- Window elements
  58. theme:set_color(lumacs.ThemeElement.WindowBorder, current, background)
  59. theme:set_color(lumacs.ThemeElement.WindowBorderActive, purple, background)
  60. theme:set_color(lumacs.ThemeElement.WindowSeparator, current, background)
  61. theme:set_color(lumacs.ThemeElement.TabLine, comment, current)
  62. theme:set_color(lumacs.ThemeElement.TabLineSel, foreground, purple)
  63. -- === SYNTAX HIGHLIGHTING FACES (Rich Styling) ===
  64. -- Base default face
  65. local default_face = lumacs.FaceAttributes()
  66. default_face.foreground = foreground
  67. default_face.background = background
  68. default_face.family = "JetBrains Mono"
  69. default_face.height = 110 -- 11pt
  70. default_face.weight = lumacs.FontWeight.Normal
  71. default_face.slant = lumacs.FontSlant.Normal
  72. theme:set_face("default", default_face)
  73. -- Keywords (pink, bold)
  74. local keyword_face = lumacs.FaceAttributes()
  75. keyword_face.foreground = pink
  76. keyword_face.weight = lumacs.FontWeight.Bold
  77. keyword_face.inherit = "default"
  78. theme:set_face("font-lock-keyword-face", keyword_face)
  79. -- Strings (yellow, italic)
  80. local string_face = lumacs.FaceAttributes()
  81. string_face.foreground = yellow
  82. string_face.slant = lumacs.FontSlant.Italic
  83. string_face.inherit = "default"
  84. theme:set_face("font-lock-string-face", string_face)
  85. -- Comments (comment blue, italic, light weight)
  86. local comment_face = lumacs.FaceAttributes()
  87. comment_face.foreground = comment
  88. comment_face.slant = lumacs.FontSlant.Italic
  89. comment_face.weight = lumacs.FontWeight.Light
  90. comment_face.inherit = "default"
  91. theme:set_face("font-lock-comment-face", comment_face)
  92. -- Function names (green, bold)
  93. local function_face = lumacs.FaceAttributes()
  94. function_face.foreground = green
  95. function_face.weight = lumacs.FontWeight.Bold
  96. function_face.inherit = "default"
  97. theme:set_face("font-lock-function-name-face", function_face)
  98. -- Type names (cyan, bold)
  99. local type_face = lumacs.FaceAttributes()
  100. type_face.foreground = cyan
  101. type_face.weight = lumacs.FontWeight.Bold
  102. type_face.inherit = "default"
  103. theme:set_face("font-lock-type-face", type_face)
  104. -- Variables (foreground, normal)
  105. local variable_face = lumacs.FaceAttributes()
  106. variable_face.foreground = foreground
  107. variable_face.inherit = "default"
  108. theme:set_face("font-lock-variable-name-face", variable_face)
  109. -- Constants (purple, bold)
  110. local constant_face = lumacs.FaceAttributes()
  111. constant_face.foreground = purple
  112. constant_face.weight = lumacs.FontWeight.Bold
  113. constant_face.inherit = "default"
  114. theme:set_face("font-lock-constant-face", constant_face)
  115. -- Builtin functions (cyan, bold, underline)
  116. local builtin_face = lumacs.FaceAttributes()
  117. builtin_face.foreground = cyan
  118. builtin_face.weight = lumacs.FontWeight.Bold
  119. builtin_face.underline = true
  120. builtin_face.inherit = "default"
  121. theme:set_face("font-lock-builtin-face", builtin_face)
  122. -- Preprocessor (pink, bold, underline)
  123. local preprocessor_face = lumacs.FaceAttributes()
  124. preprocessor_face.foreground = pink
  125. preprocessor_face.weight = lumacs.FontWeight.Bold
  126. preprocessor_face.underline = true
  127. preprocessor_face.inherit = "default"
  128. theme:set_face("font-lock-preprocessor-face", preprocessor_face)
  129. -- Numbers (purple, normal)
  130. local number_face = lumacs.FaceAttributes()
  131. number_face.foreground = purple
  132. number_face.inherit = "default"
  133. theme:set_face("font-lock-number-face", number_face)
  134. -- === UI FACES (Rich Styling) ===
  135. -- Mode line (status bar) - purple background, bold
  136. local modeline_face = lumacs.FaceAttributes()
  137. modeline_face.foreground = foreground
  138. modeline_face.background = dark_purple
  139. modeline_face.weight = lumacs.FontWeight.Bold
  140. modeline_face.family = "Inter"
  141. modeline_face.height = 100
  142. theme:set_face("mode-line", modeline_face)
  143. -- Inactive mode line
  144. local modeline_inactive_face = lumacs.FaceAttributes()
  145. modeline_inactive_face.foreground = comment
  146. modeline_inactive_face.background = current
  147. modeline_inactive_face.weight = lumacs.FontWeight.Normal
  148. modeline_inactive_face.inherit = "mode-line"
  149. theme:set_face("mode-line-inactive", modeline_inactive_face)
  150. -- Minibuffer prompt (pink, bold)
  151. local minibuffer_prompt_face = lumacs.FaceAttributes()
  152. minibuffer_prompt_face.foreground = pink
  153. minibuffer_prompt_face.weight = lumacs.FontWeight.Bold
  154. minibuffer_prompt_face.inherit = "default"
  155. theme:set_face("minibuffer-prompt", minibuffer_prompt_face)
  156. -- Line numbers (comment, small)
  157. local line_number_face = lumacs.FaceAttributes()
  158. line_number_face.foreground = comment
  159. line_number_face.background = background
  160. line_number_face.family = "JetBrains Mono"
  161. line_number_face.height = 90 -- Smaller than main text
  162. line_number_face.weight = lumacs.FontWeight.Light
  163. theme:set_face("line-number", line_number_face)
  164. -- Current line number (highlighted)
  165. local line_number_current_face = lumacs.FaceAttributes()
  166. line_number_current_face.foreground = orange
  167. line_number_current_face.weight = lumacs.FontWeight.Bold
  168. line_number_current_face.inherit = "line-number"
  169. theme:set_face("line-number-current", line_number_current_face)
  170. -- Cursor (inverse, bold)
  171. local cursor_face = lumacs.FaceAttributes()
  172. cursor_face.foreground = background
  173. cursor_face.background = foreground
  174. cursor_face.inverse = true
  175. cursor_face.weight = lumacs.FontWeight.Bold
  176. cursor_face.inherit = "default"
  177. theme:set_face("cursor", cursor_face)
  178. -- Selection/region (selection background, bold)
  179. local region_face = lumacs.FaceAttributes()
  180. region_face.foreground = foreground
  181. region_face.background = selection
  182. region_face.weight = lumacs.FontWeight.Bold
  183. theme:set_face("region", region_face)
  184. -- Search matches (orange background, bold)
  185. local isearch_face = lumacs.FaceAttributes()
  186. isearch_face.foreground = background
  187. isearch_face.background = orange
  188. isearch_face.weight = lumacs.FontWeight.Bold
  189. theme:set_face("isearch", isearch_face)
  190. -- Failed search (red background, bold)
  191. local isearch_fail_face = lumacs.FaceAttributes()
  192. isearch_fail_face.foreground = foreground
  193. isearch_fail_face.background = red
  194. isearch_fail_face.weight = lumacs.FontWeight.Bold
  195. isearch_fail_face.underline = true
  196. theme:set_face("isearch-fail", isearch_fail_face)
  197. -- === ERROR AND WARNING FACES ===
  198. -- Error (red background, white text, bold, underline)
  199. local error_face = lumacs.FaceAttributes()
  200. error_face.foreground = foreground
  201. error_face.background = red
  202. error_face.weight = lumacs.FontWeight.Bold
  203. error_face.underline = true
  204. theme:set_face("error", error_face)
  205. -- Warning (orange, bold)
  206. local warning_face = lumacs.FaceAttributes()
  207. warning_face.foreground = orange
  208. warning_face.weight = lumacs.FontWeight.Bold
  209. warning_face.inherit = "default"
  210. theme:set_face("warning", warning_face)
  211. -- Success (green, bold)
  212. local success_face = lumacs.FaceAttributes()
  213. success_face.foreground = green
  214. success_face.weight = lumacs.FontWeight.Bold
  215. success_face.inherit = "default"
  216. theme:set_face("success", success_face)
  217. -- === WINDOW AND UI ELEMENTS ===
  218. -- Window borders
  219. local window_divider_face = lumacs.FaceAttributes()
  220. window_divider_face.foreground = current
  221. window_divider_face.background = background
  222. theme:set_face("window-divider", window_divider_face)
  223. -- Active window border (highlighted)
  224. local window_divider_active_face = lumacs.FaceAttributes()
  225. window_divider_active_face.foreground = purple
  226. window_divider_active_face.background = background
  227. window_divider_active_face.weight = lumacs.FontWeight.Bold
  228. theme:set_face("window-divider-active", window_divider_active_face)
  229. -- === COMPLETION AND MINIBUFFER ===
  230. -- Completion candidates
  231. local completion_face = lumacs.FaceAttributes()
  232. completion_face.foreground = foreground
  233. completion_face.background = current
  234. completion_face.inherit = "default"
  235. theme:set_face("completions-common-part", completion_face)
  236. -- Highlighted completion
  237. local completion_selected_face = lumacs.FaceAttributes()
  238. completion_selected_face.foreground = background
  239. completion_selected_face.background = purple
  240. completion_selected_face.weight = lumacs.FontWeight.Bold
  241. theme:set_face("completions-first-difference", completion_selected_face)
  242. print(string.format("Enhanced theme '%s' loaded with rich Dracula styling.", theme:name()))