tokyo-night.lua 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. -- Tokyo Night Theme for Lumacs
  2. -- Enhanced version with rich styling using all available face attributes
  3. -- Based on the popular Tokyo Night color scheme
  4. local theme = editor:create_and_register_theme("tokyo-night")
  5. -- Tokyo Night color palette
  6. local bg = lumacs.Color(26, 27, 38) -- #1a1b26
  7. local bg_dark = lumacs.Color(22, 22, 30) -- #16161e
  8. local bg_float = lumacs.Color(22, 22, 30) -- #16161e
  9. local bg_highlight = lumacs.Color(40, 42, 56) -- #292e42
  10. local bg_popup = lumacs.Color(22, 22, 30) -- #16161e
  11. local bg_search = lumacs.Color(61, 89, 161) -- #3d59a1
  12. local bg_sidebar = lumacs.Color(22, 22, 30) -- #16161e
  13. local bg_statusline = lumacs.Color(22, 22, 30) -- #16161e
  14. local bg_visual = lumacs.Color(56, 62, 90) -- #383e5a
  15. local border = lumacs.Color(22, 22, 30) -- #16161e
  16. local comment = lumacs.Color(86, 95, 137) -- #565f89
  17. local fg = lumacs.Color(192, 202, 245) -- #c0caf5
  18. local fg_dark = lumacs.Color(169, 177, 214) -- #a9b1d6
  19. local fg_gutter = lumacs.Color(60, 70, 110) -- #3c466e
  20. -- Tokyo Night colors
  21. local blue = lumacs.Color(125, 180, 255) -- #7dcfff
  22. local blue0 = lumacs.Color(61, 89, 161) -- #3d59a1
  23. local blue1 = lumacs.Color(44, 82, 130) -- #2c5282
  24. local blue2 = lumacs.Color(0, 111, 184) -- #006fb8
  25. local blue5 = lumacs.Color(137, 180, 250) -- #89b4fa
  26. local blue6 = lumacs.Color(179, 214, 255) -- #b3d6ff
  27. local blue7 = lumacs.Color(188, 225, 251) -- #bce1fb
  28. local cyan = lumacs.Color(125, 207, 255) -- #7dcfff
  29. local green = lumacs.Color(158, 206, 106) -- #9ece6a
  30. local green1 = lumacs.Color(115, 179, 85) -- #73b755
  31. local green2 = lumacs.Color(65, 166, 181) -- #41a6b5
  32. local magenta = lumacs.Color(187, 154, 247) -- #bb9af7
  33. local magenta2 = lumacs.Color(255, 0, 135) -- #ff0087
  34. local orange = lumacs.Color(255, 158, 100) -- #ff9e64
  35. local purple = lumacs.Color(159, 120, 255) -- #9f78ff
  36. local red = lumacs.Color(247, 118, 142) -- #f7768e
  37. local red1 = lumacs.Color(219, 75, 75) -- #db4b4b
  38. local teal = lumacs.Color(26, 188, 156) -- #1abc9c
  39. local yellow = lumacs.Color(224, 175, 104) -- #e0af68
  40. -- === SET ALL THEME ELEMENTS (Complete theming) ===
  41. -- Special elements (base)
  42. theme:set_color(lumacs.ThemeElement.Background, fg, bg)
  43. theme:set_color(lumacs.ThemeElement.Foreground, fg, bg)
  44. theme:set_color(lumacs.ThemeElement.Normal, fg, bg)
  45. -- Text syntax elements
  46. theme:set_color(lumacs.ThemeElement.Keyword, magenta, bg)
  47. theme:set_color(lumacs.ThemeElement.String, green, bg)
  48. theme:set_color(lumacs.ThemeElement.Comment, comment, bg)
  49. theme:set_color(lumacs.ThemeElement.Function, blue, bg)
  50. theme:set_color(lumacs.ThemeElement.Type, cyan, bg)
  51. theme:set_color(lumacs.ThemeElement.Number, orange, bg)
  52. theme:set_color(lumacs.ThemeElement.Constant, orange, bg)
  53. theme:set_color(lumacs.ThemeElement.Variable, fg, bg)
  54. theme:set_color(lumacs.ThemeElement.Builtin, red, bg)
  55. theme:set_color(lumacs.ThemeElement.Preprocessor, purple, bg)
  56. theme:set_color(lumacs.ThemeElement.Operator, blue5, bg)
  57. theme:set_color(lumacs.ThemeElement.Error, fg, red)
  58. theme:set_color(lumacs.ThemeElement.Warning, bg, yellow)
  59. -- UI elements
  60. theme:set_color(lumacs.ThemeElement.StatusLine, fg, bg_statusline)
  61. theme:set_color(lumacs.ThemeElement.StatusLineInactive, comment, bg_sidebar)
  62. theme:set_color(lumacs.ThemeElement.MessageLine, fg, bg)
  63. theme:set_color(lumacs.ThemeElement.LineNumber, fg_gutter, bg)
  64. theme:set_color(lumacs.ThemeElement.LineNumberCurrent, fg, bg)
  65. theme:set_color(lumacs.ThemeElement.Cursor, bg, fg)
  66. theme:set_color(lumacs.ThemeElement.Selection, fg, bg_visual)
  67. theme:set_color(lumacs.ThemeElement.SearchMatch, bg, yellow)
  68. theme:set_color(lumacs.ThemeElement.SearchFail, fg, red)
  69. theme:set_color(lumacs.ThemeElement.MatchParen, bg, cyan)
  70. -- Minibuffer elements
  71. theme:set_color(lumacs.ThemeElement.MinibufferPrompt, blue, bg)
  72. theme:set_color(lumacs.ThemeElement.MinibufferInput, fg, bg_popup)
  73. theme:set_color(lumacs.ThemeElement.MinibufferCompletion, fg_dark, bg_popup)
  74. theme:set_color(lumacs.ThemeElement.MinibufferMatch, bg, magenta)
  75. -- Window elements
  76. theme:set_color(lumacs.ThemeElement.WindowBorder, border, bg)
  77. theme:set_color(lumacs.ThemeElement.WindowBorderActive, blue, bg)
  78. theme:set_color(lumacs.ThemeElement.WindowSeparator, border, bg)
  79. theme:set_color(lumacs.ThemeElement.TabLine, comment, bg_statusline)
  80. theme:set_color(lumacs.ThemeElement.TabLineSel, fg, blue0)
  81. -- === SYNTAX HIGHLIGHTING FACES (Rich Styling) ===
  82. -- Base default face
  83. local default_face = lumacs.FaceAttributes()
  84. default_face.foreground = fg
  85. default_face.background = bg
  86. default_face.family = "Cascadia Code"
  87. default_face.height = 110 -- 11pt
  88. default_face.weight = lumacs.FontWeight.Normal
  89. default_face.slant = lumacs.FontSlant.Normal
  90. theme:set_face("default", default_face)
  91. -- Keywords (magenta, bold)
  92. local keyword_face = lumacs.FaceAttributes()
  93. keyword_face.foreground = magenta
  94. keyword_face.weight = lumacs.FontWeight.Bold
  95. keyword_face.inherit = "default"
  96. theme:set_face("font-lock-keyword-face", keyword_face)
  97. -- Strings (green, italic)
  98. local string_face = lumacs.FaceAttributes()
  99. string_face.foreground = green
  100. string_face.slant = lumacs.FontSlant.Italic
  101. string_face.inherit = "default"
  102. theme:set_face("font-lock-string-face", string_face)
  103. -- Comments (comment, italic, light)
  104. local comment_face = lumacs.FaceAttributes()
  105. comment_face.foreground = comment
  106. comment_face.slant = lumacs.FontSlant.Italic
  107. comment_face.weight = lumacs.FontWeight.Light
  108. comment_face.inherit = "default"
  109. theme:set_face("font-lock-comment-face", comment_face)
  110. -- Function names (blue, bold)
  111. local function_face = lumacs.FaceAttributes()
  112. function_face.foreground = blue
  113. function_face.weight = lumacs.FontWeight.Bold
  114. function_face.inherit = "default"
  115. theme:set_face("font-lock-function-name-face", function_face)
  116. -- Type names (cyan, bold)
  117. local type_face = lumacs.FaceAttributes()
  118. type_face.foreground = cyan
  119. type_face.weight = lumacs.FontWeight.Bold
  120. type_face.inherit = "default"
  121. theme:set_face("font-lock-type-face", type_face)
  122. -- Variables (fg, normal)
  123. local variable_face = lumacs.FaceAttributes()
  124. variable_face.foreground = fg
  125. variable_face.inherit = "default"
  126. theme:set_face("font-lock-variable-name-face", variable_face)
  127. -- Constants (orange, bold)
  128. local constant_face = lumacs.FaceAttributes()
  129. constant_face.foreground = orange
  130. constant_face.weight = lumacs.FontWeight.Bold
  131. constant_face.inherit = "default"
  132. theme:set_face("font-lock-constant-face", constant_face)
  133. -- Builtin functions (red, bold, underline)
  134. local builtin_face = lumacs.FaceAttributes()
  135. builtin_face.foreground = red
  136. builtin_face.weight = lumacs.FontWeight.Bold
  137. builtin_face.underline = true
  138. builtin_face.inherit = "default"
  139. theme:set_face("font-lock-builtin-face", builtin_face)
  140. -- === UI FACES (Rich Styling) ===
  141. -- Mode line (status bar)
  142. local modeline_face = lumacs.FaceAttributes()
  143. modeline_face.foreground = fg
  144. modeline_face.background = bg_statusline
  145. modeline_face.weight = lumacs.FontWeight.Bold
  146. modeline_face.family = "SF Pro Display"
  147. modeline_face.height = 100
  148. theme:set_face("mode-line", modeline_face)
  149. -- Inactive mode line
  150. local modeline_inactive_face = lumacs.FaceAttributes()
  151. modeline_inactive_face.foreground = comment
  152. modeline_inactive_face.background = bg_sidebar
  153. modeline_inactive_face.inherit = "mode-line"
  154. theme:set_face("mode-line-inactive", modeline_inactive_face)
  155. -- Minibuffer prompt (blue, bold)
  156. local minibuffer_prompt_face = lumacs.FaceAttributes()
  157. minibuffer_prompt_face.foreground = blue
  158. minibuffer_prompt_face.weight = lumacs.FontWeight.Bold
  159. minibuffer_prompt_face.inherit = "default"
  160. theme:set_face("minibuffer-prompt", minibuffer_prompt_face)
  161. -- Line numbers (fg_gutter, small)
  162. local line_number_face = lumacs.FaceAttributes()
  163. line_number_face.foreground = fg_gutter
  164. line_number_face.background = bg
  165. line_number_face.family = "Cascadia Code"
  166. line_number_face.height = 90
  167. line_number_face.weight = lumacs.FontWeight.Light
  168. theme:set_face("line-number", line_number_face)
  169. -- Current line number (highlighted)
  170. local line_number_current_face = lumacs.FaceAttributes()
  171. line_number_current_face.foreground = fg
  172. line_number_current_face.weight = lumacs.FontWeight.Bold
  173. line_number_current_face.inherit = "line-number"
  174. theme:set_face("line-number-current", line_number_current_face)
  175. -- Cursor (inverse, bold)
  176. local cursor_face = lumacs.FaceAttributes()
  177. cursor_face.foreground = bg
  178. cursor_face.background = fg
  179. cursor_face.inverse = true
  180. cursor_face.weight = lumacs.FontWeight.Bold
  181. cursor_face.inherit = "default"
  182. theme:set_face("cursor", cursor_face)
  183. -- Selection/region (bg_visual background)
  184. local region_face = lumacs.FaceAttributes()
  185. region_face.foreground = fg
  186. region_face.background = bg_visual
  187. region_face.weight = lumacs.FontWeight.Bold
  188. theme:set_face("region", region_face)
  189. -- Search matches (yellow background, bold)
  190. local isearch_face = lumacs.FaceAttributes()
  191. isearch_face.foreground = bg
  192. isearch_face.background = yellow
  193. isearch_face.weight = lumacs.FontWeight.Bold
  194. theme:set_face("isearch", isearch_face)
  195. -- Error (red background, bold, underline)
  196. local error_face = lumacs.FaceAttributes()
  197. error_face.foreground = fg
  198. error_face.background = red
  199. error_face.weight = lumacs.FontWeight.Bold
  200. error_face.underline = true
  201. theme:set_face("error", error_face)
  202. -- Warning (yellow, bold)
  203. local warning_face = lumacs.FaceAttributes()
  204. warning_face.foreground = yellow
  205. warning_face.weight = lumacs.FontWeight.Bold
  206. warning_face.inherit = "default"
  207. theme:set_face("warning", warning_face)
  208. -- Success (green, bold)
  209. local success_face = lumacs.FaceAttributes()
  210. success_face.foreground = green
  211. success_face.weight = lumacs.FontWeight.Bold
  212. success_face.inherit = "default"
  213. theme:set_face("success", success_face)
  214. print(string.format("Enhanced theme '%s' loaded with complete Tokyo Night styling.", theme:name()))