|
| 1 | +# :crescent_moon: Midnight |
| 2 | + |
| 3 | +A modern black [neovim](https://github.com/neovim/neovim) theme written in Lua, with a strong focus |
| 4 | +on maintaining a comfortable level of color contrast for a pleasant visual experience while coding. |
| 5 | + |
| 6 | +## Showcase |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +## Vision |
| 15 | + |
| 16 | +As a lover of dark themes and all things black, I searched far and wide for black background |
| 17 | +colorschemes when I first started using **neovim**. Although I have used many well-crafted themes so |
| 18 | +far, it would always come down to choosing between one of these two: *healthy color contrast* and |
| 19 | +*focused semantic clarity*. It is quite difficult to nail the balance between both, especially when |
| 20 | +working with ***black*** backgrounds. Focusing too much on the former would result in a tame and |
| 21 | +uniform looking theme, whereas too much emphasis on the latter would cause the screen content to |
| 22 | +have sharp changes in color straining the eyes. I created this colorscheme to find the perfect |
| 23 | +balance between both, to provide focus and clarity while ensuring a healthy contrast level. |
| 24 | + |
| 25 | +**midnight.nvim** leans towards mostly using shades of gray, followed by blue-green shades for a |
| 26 | +cooler UI color experience, while using warmer colors only for syntax and status. Most colors have |
| 27 | +sufficiently low saturation so they do not stand out against the jet black background to avoid eye |
| 28 | +strain when working for a longer duration (particularly beneficial in low-light conditions). |
| 29 | + |
| 30 | +***NOTE: This plugin is a WIP. There are still a few color choices that I am not satisfied with and |
| 31 | +will be changed in the future. Other than these select few, most colors are stable and the theme's |
| 32 | +appearance will not change as a whole.*** |
| 33 | + |
| 34 | +## Features |
| 35 | + |
| 36 | +- Support for treesitter and LSP syntax groups for multiple filetypes |
| 37 | +- Appropriate color contrast between content and UI to reduce eye strain while maintaining focus |
| 38 | +- Darker shades of gray for non-critical UI elements such as separators to reduce distraction |
| 39 | +- Consistent usage of the palette across plugins and neovim builtins to provide a unified IDE-like |
| 40 | +appearance |
| 41 | +- Warmer colors for multiple language syntax groups to attract attention intuitively in dense code |
| 42 | +files |
| 43 | + |
| 44 | +#### Integrations |
| 45 | + |
| 46 | +The following plugins have fully customized highlight groups - |
| 47 | + |
| 48 | +- [lazy.nvim](https://github.com/folke/lazy.nvim) |
| 49 | +- [nvim-tree.lua](https://github.com/nvim-tree/nvim-tree.lua) |
| 50 | +- [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim) |
| 51 | +- [diffview.nvim](https://github.com/sindrets/diffview.nvim) |
| 52 | +- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) |
| 53 | +- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) |
| 54 | +- [todo-comments.nvim](https://github.com/folke/todo-comments.nvim) |
| 55 | +- [mason.nvim](https://github.com/williamboman/mason.nvim) |
| 56 | +- [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui) |
| 57 | +- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) |
| 58 | +- [neorg](https://github.com/nvim-neorg/neorg) |
| 59 | + |
| 60 | +## Installation |
| 61 | + |
| 62 | +Install the colorscheme using the package manager that you love! |
| 63 | + |
| 64 | +[lazy.nvim](https://github.com/folke/lazy.nvim) |
| 65 | + |
| 66 | +```lua |
| 67 | +-- LazySpec (plugin specification) |
| 68 | +-- return { |
| 69 | +{ 'dasupradyumna/midnight.nvim', lazy = false, priority = 1000 } |
| 70 | +-- } |
| 71 | +``` |
| 72 | + |
| 73 | +[packer.nvim](https://github.com/wbthomason/packer.nvim) |
| 74 | + |
| 75 | +```lua |
| 76 | +-- inside setup function |
| 77 | +-- packer.startup(function(use) |
| 78 | +use { 'dasupradyumna/midnight.nvim' } |
| 79 | +-- end) |
| 80 | +``` |
| 81 | + |
| 82 | +### Requirements |
| 83 | + |
| 84 | +***midnight.nvim*** is a *GUI-only* colorscheme. It requires GUI client or a modern terminal version |
| 85 | +of **neovim** installed in a |
| 86 | +[true-color supported](https://github.com/termstandard/colors#truecolor-support-in-output-devices) |
| 87 | +terminal emulator. |
| 88 | + |
| 89 | +**Neovim** version should be newer than 0.8.0. |
| 90 | + |
| 91 | +## Usage |
| 92 | + |
| 93 | +Add the following code snippet to load the colorscheme. |
| 94 | + |
| 95 | +```lua |
| 96 | +-- Lua |
| 97 | +vim.cmd.colorscheme 'midnight' |
| 98 | +``` |
| 99 | + |
| 100 | +```vim |
| 101 | +" VimScript |
| 102 | +colorscheme midnight |
| 103 | +``` |
| 104 | + |
| 105 | +### Configuration |
| 106 | + |
| 107 | +Configuration can be skipped if the user does not wish to change any of the default higlight groups. |
| 108 | +The plugin runs setup automatically when it is loaded using the `colorscheme` command. |
| 109 | + |
| 110 | +For now, users can directly add overriding higlight groups as arguments to the `setup()` method. |
| 111 | +Better options will be added in the future to make the colorscheme customization simpler. |
| 112 | + |
| 113 | +```lua |
| 114 | +require('midnight').setup { |
| 115 | + HighlightGroup = { |
| 116 | + fg = ForegroundColor, -- :h guifg |
| 117 | + bg = BackgroundColor, -- :h guibg |
| 118 | + sp = SpecialColor, -- :h guisp |
| 119 | + style = RenderStyle, -- :h attr-list |
| 120 | + -- OR |
| 121 | + link = TargetHiglightGroup -- :h :hi-link (link to "TargetHiglightGroup") |
| 122 | + -- OR |
| 123 | + clear = true -- :h :hi-clear (clear "HighlightGroup"; `false` ignores this option) |
| 124 | + }, |
| 125 | + ... |
| 126 | +} |
| 127 | +``` |
| 128 | + |
| 129 | +The evaluation priority of options within a highlight specification (*like above*) is: |
| 130 | + |
| 131 | +1. When `clear = true` is specified, all other attributes are ignored |
| 132 | +2. When a `link` group name is specified, all attributes except `clear` are ignored |
| 133 | +3. Highlight specification using `fg`, `bg`, `sp` and `style` is evaluated only if above attributes |
| 134 | +are not specified |
| 135 | + |
| 136 | +### Color Palette |
| 137 | + |
| 138 | +Although quite limited in variety, **midnight.nvim** color palette can be used from |
| 139 | +[palette.lua](lua/midnight/palette.lua), if the user so wishes. |
| 140 | + |
| 141 | +```lua |
| 142 | +local colors = require('midnight.colors') |
| 143 | +local p = colors.palette -- raw color palette |
| 144 | +local c = colors.components -- component color palette |
| 145 | +``` |
| 146 | + |
| 147 | +## Contributing |
| 148 | + |
| 149 | +I encourage fellow contributors to submit PRs if they wish to fix a bug or add a feature. |
| 150 | +Since I cannot feasibly test out every single possibility, I would love it if contributors can help |
| 151 | +in improving the documentation especially for other package managers. |
| 152 | +I would also like help with LSP and treesitter groups for languages that have not been covered. |
| 153 | + |
| 154 | +*Since this is my first plugin, all suggestions and advice from the more experienced are welcome.* |
| 155 | + |
| 156 | +## Thanks |
| 157 | + |
| 158 | +This colorscheme's design was inspired by **nyoom-engineering**'s |
| 159 | +[oxocarbon.nvim](https://github.com/nyoom-engineering/oxocarbon.nvim) and highlighting logic |
| 160 | +was inspired by **folke**'s [tokyonight.nvim](https://github.com/folke/tokyonight.nvim). |
| 161 | + |
| 162 | +## License |
| 163 | + |
| 164 | +**midnight.nvim** is licensed under the *Apache License 2.0*. |
0 commit comments