catppuccin-mocha.lua 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. -- Catppuccin Mocha Theme for Lumacs
  2. -- Enhanced version with rich styling using all available face attributes
  3. -- Based on the popular Catppuccin color scheme (Mocha variant)
  4. local theme = editor:create_and_register_theme("catppuccin-mocha")
  5. -- Catppuccin Mocha color palette
  6. local base = lumacs.Color(30, 30, 46) -- #1e1e2e
  7. local mantle = lumacs.Color(24, 24, 37) -- #181825
  8. local crust = lumacs.Color(17, 17, 27) -- #11111b
  9. local surface0 = lumacs.Color(49, 50, 68) -- #313244
  10. local surface1 = lumacs.Color(69, 71, 90) -- #45475a
  11. local surface2 = lumacs.Color(88, 91, 112) -- #585b70
  12. local overlay0 = lumacs.Color(108, 112, 134) -- #6c7086
  13. local overlay1 = lumacs.Color(127, 132, 156) -- #7f849c
  14. local overlay2 = lumacs.Color(147, 153, 178) -- #9399b2
  15. local subtext0 = lumacs.Color(166, 173, 200) -- #a6adc8
  16. local subtext1 = lumacs.Color(186, 194, 222) -- #bac2de
  17. local text = lumacs.Color(205, 214, 244) -- #cdd6f4
  18. -- Catppuccin colors
  19. local rosewater = lumacs.Color(245, 224, 220) -- #f5e0dc
  20. local flamingo = lumacs.Color(242, 205, 205) -- #f2cdcd
  21. local pink = lumacs.Color(245, 194, 231) -- #f5c2e7
  22. local mauve = lumacs.Color(203, 166, 247) -- #cba6f7
  23. local red = lumacs.Color(243, 139, 168) -- #f38ba8
  24. local maroon = lumacs.Color(235, 160, 172) -- #eba0ac
  25. local peach = lumacs.Color(250, 179, 135) -- #fab387
  26. local yellow = lumacs.Color(249, 226, 175) -- #f9e2af
  27. local green = lumacs.Color(166, 227, 161) -- #a6e3a1
  28. local teal = lumacs.Color(148, 226, 213) -- #94e2d5
  29. local sky = lumacs.Color(137, 220, 235) -- #89dceb
  30. local sapphire = lumacs.Color(116, 199, 236) -- #74c7ec
  31. local blue = lumacs.Color(137, 180, 250) -- #89b4fa
  32. local lavender = lumacs.Color(180, 190, 254) -- #b4befe
  33. -- === SET ALL THEME ELEMENTS (Complete theming) ===
  34. -- Special elements (base)
  35. theme:set_color(lumacs.ThemeElement.Background, text, base)
  36. theme:set_color(lumacs.ThemeElement.Foreground, text, base)
  37. theme:set_color(lumacs.ThemeElement.Normal, text, base)
  38. -- Text syntax elements
  39. theme:set_color(lumacs.ThemeElement.Keyword, mauve, base)
  40. theme:set_color(lumacs.ThemeElement.String, green, base)
  41. theme:set_color(lumacs.ThemeElement.Comment, overlay0, base)
  42. theme:set_color(lumacs.ThemeElement.Function, blue, base)
  43. theme:set_color(lumacs.ThemeElement.Type, yellow, base)
  44. theme:set_color(lumacs.ThemeElement.Number, peach, base)
  45. theme:set_color(lumacs.ThemeElement.Constant, peach, base)
  46. theme:set_color(lumacs.ThemeElement.Variable, text, base)
  47. theme:set_color(lumacs.ThemeElement.Builtin, red, base)
  48. theme:set_color(lumacs.ThemeElement.Preprocessor, pink, base)
  49. theme:set_color(lumacs.ThemeElement.Operator, sky, base)
  50. theme:set_color(lumacs.ThemeElement.Error, text, red)
  51. theme:set_color(lumacs.ThemeElement.Warning, base, yellow)
  52. -- UI elements
  53. theme:set_color(lumacs.ThemeElement.StatusLine, text, surface0)
  54. theme:set_color(lumacs.ThemeElement.StatusLineInactive, overlay1, surface1)
  55. theme:set_color(lumacs.ThemeElement.MessageLine, text, base)
  56. theme:set_color(lumacs.ThemeElement.LineNumber, overlay0, base)
  57. theme:set_color(lumacs.ThemeElement.LineNumberCurrent, lavender, base)
  58. theme:set_color(lumacs.ThemeElement.Cursor, base, text)
  59. theme:set_color(lumacs.ThemeElement.Selection, text, surface1)
  60. theme:set_color(lumacs.ThemeElement.SearchMatch, base, yellow)
  61. theme:set_color(lumacs.ThemeElement.SearchFail, text, red)
  62. theme:set_color(lumacs.ThemeElement.MatchParen, base, pink)
  63. -- Minibuffer elements
  64. theme:set_color(lumacs.ThemeElement.MinibufferPrompt, lavender, base)
  65. theme:set_color(lumacs.ThemeElement.MinibufferInput, text, surface0)
  66. theme:set_color(lumacs.ThemeElement.MinibufferCompletion, subtext1, surface0)
  67. theme:set_color(lumacs.ThemeElement.MinibufferMatch, base, mauve)
  68. -- Window elements
  69. theme:set_color(lumacs.ThemeElement.WindowBorder, surface1, base)
  70. theme:set_color(lumacs.ThemeElement.WindowBorderActive, lavender, base)
  71. theme:set_color(lumacs.ThemeElement.WindowSeparator, surface1, base)
  72. theme:set_color(lumacs.ThemeElement.TabLine, overlay1, surface0)
  73. theme:set_color(lumacs.ThemeElement.TabLineSel, text, mauve)
  74. -- === SYNTAX HIGHLIGHTING FACES (Rich Styling) ===
  75. -- Base default face
  76. local default_face = lumacs.FaceAttributes()
  77. default_face.foreground = text
  78. default_face.background = base
  79. default_face.family = "Iosevka"
  80. default_face.height = 110 -- 11pt
  81. default_face.weight = lumacs.FontWeight.Normal
  82. default_face.slant = lumacs.FontSlant.Normal
  83. theme:set_face("default", default_face)
  84. -- Keywords (mauve, bold)
  85. local keyword_face = lumacs.FaceAttributes()
  86. keyword_face.foreground = mauve
  87. keyword_face.weight = lumacs.FontWeight.Bold
  88. keyword_face.inherit = "default"
  89. theme:set_face("font-lock-keyword-face", keyword_face)
  90. -- Strings (green, italic)
  91. local string_face = lumacs.FaceAttributes()
  92. string_face.foreground = green
  93. string_face.slant = lumacs.FontSlant.Italic
  94. string_face.inherit = "default"
  95. theme:set_face("font-lock-string-face", string_face)
  96. -- Comments (overlay0, italic, light)
  97. local comment_face = lumacs.FaceAttributes()
  98. comment_face.foreground = overlay0
  99. comment_face.slant = lumacs.FontSlant.Italic
  100. comment_face.weight = lumacs.FontWeight.Light
  101. comment_face.inherit = "default"
  102. theme:set_face("font-lock-comment-face", comment_face)
  103. -- Function names (blue, bold)
  104. local function_face = lumacs.FaceAttributes()
  105. function_face.foreground = blue
  106. function_face.weight = lumacs.FontWeight.Bold
  107. function_face.inherit = "default"
  108. theme:set_face("font-lock-function-name-face", function_face)
  109. -- Type names (yellow, bold)
  110. local type_face = lumacs.FaceAttributes()
  111. type_face.foreground = yellow
  112. type_face.weight = lumacs.FontWeight.Bold
  113. type_face.inherit = "default"
  114. theme:set_face("font-lock-type-face", type_face)
  115. -- Variables (text, normal)
  116. local variable_face = lumacs.FaceAttributes()
  117. variable_face.foreground = text
  118. variable_face.inherit = "default"
  119. theme:set_face("font-lock-variable-name-face", variable_face)
  120. -- Constants (peach, bold)
  121. local constant_face = lumacs.FaceAttributes()
  122. constant_face.foreground = peach
  123. constant_face.weight = lumacs.FontWeight.Bold
  124. constant_face.inherit = "default"
  125. theme:set_face("font-lock-constant-face", constant_face)
  126. -- Builtin functions (red, bold, underline)
  127. local builtin_face = lumacs.FaceAttributes()
  128. builtin_face.foreground = red
  129. builtin_face.weight = lumacs.FontWeight.Bold
  130. builtin_face.underline = true
  131. builtin_face.inherit = "default"
  132. theme:set_face("font-lock-builtin-face", builtin_face)
  133. -- === UI FACES (Rich Styling) ===
  134. -- Mode line (status bar) - surface0 background, text foreground
  135. local modeline_face = lumacs.FaceAttributes()
  136. modeline_face.foreground = text
  137. modeline_face.background = surface0
  138. modeline_face.weight = lumacs.FontWeight.Bold
  139. modeline_face.family = "Inter"
  140. modeline_face.height = 100
  141. theme:set_face("mode-line", modeline_face)
  142. -- Inactive mode line
  143. local modeline_inactive_face = lumacs.FaceAttributes()
  144. modeline_inactive_face.foreground = overlay1
  145. modeline_inactive_face.background = surface1
  146. modeline_inactive_face.inherit = "mode-line"
  147. theme:set_face("mode-line-inactive", modeline_inactive_face)
  148. -- Minibuffer prompt (lavender, bold)
  149. local minibuffer_prompt_face = lumacs.FaceAttributes()
  150. minibuffer_prompt_face.foreground = lavender
  151. minibuffer_prompt_face.weight = lumacs.FontWeight.Bold
  152. minibuffer_prompt_face.inherit = "default"
  153. theme:set_face("minibuffer-prompt", minibuffer_prompt_face)
  154. -- Line numbers (overlay0, small)
  155. local line_number_face = lumacs.FaceAttributes()
  156. line_number_face.foreground = overlay0
  157. line_number_face.background = base
  158. line_number_face.family = "Iosevka"
  159. line_number_face.height = 90
  160. line_number_face.weight = lumacs.FontWeight.Light
  161. theme:set_face("line-number", line_number_face)
  162. -- Current line number (highlighted)
  163. local line_number_current_face = lumacs.FaceAttributes()
  164. line_number_current_face.foreground = lavender
  165. line_number_current_face.weight = lumacs.FontWeight.Bold
  166. line_number_current_face.inherit = "line-number"
  167. theme:set_face("line-number-current", line_number_current_face)
  168. -- Cursor (inverse, bold)
  169. local cursor_face = lumacs.FaceAttributes()
  170. cursor_face.foreground = base
  171. cursor_face.background = text
  172. cursor_face.inverse = true
  173. cursor_face.weight = lumacs.FontWeight.Bold
  174. cursor_face.inherit = "default"
  175. theme:set_face("cursor", cursor_face)
  176. -- Selection/region (surface1 background)
  177. local region_face = lumacs.FaceAttributes()
  178. region_face.foreground = text
  179. region_face.background = surface1
  180. region_face.weight = lumacs.FontWeight.Bold
  181. theme:set_face("region", region_face)
  182. -- Search matches (yellow background, bold)
  183. local isearch_face = lumacs.FaceAttributes()
  184. isearch_face.foreground = base
  185. isearch_face.background = yellow
  186. isearch_face.weight = lumacs.FontWeight.Bold
  187. theme:set_face("isearch", isearch_face)
  188. -- Error (red background, bold, underline)
  189. local error_face = lumacs.FaceAttributes()
  190. error_face.foreground = text
  191. error_face.background = red
  192. error_face.weight = lumacs.FontWeight.Bold
  193. error_face.underline = true
  194. theme:set_face("error", error_face)
  195. -- Warning (yellow, bold)
  196. local warning_face = lumacs.FaceAttributes()
  197. warning_face.foreground = yellow
  198. warning_face.weight = lumacs.FontWeight.Bold
  199. warning_face.inherit = "default"
  200. theme:set_face("warning", warning_face)
  201. -- Success (green, bold)
  202. local success_face = lumacs.FaceAttributes()
  203. success_face.foreground = green
  204. success_face.weight = lumacs.FontWeight.Bold
  205. success_face.inherit = "default"
  206. theme:set_face("success", success_face)
  207. print(string.format("Enhanced theme '%s' loaded with complete Catppuccin Mocha styling.", theme:name()))