diff --git a/README.md b/README.md index b0b2ca3..8e0cc20 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@ A colorscheme for [Neovim](https://github.com/neovim/neovim). Pleasant and produ ![preview](https://github.com/ramojus/mellifluous.nvim/assets/41536253/a4b01a46-6ec9-408a-9c2f-08995c53155a) ## Highlighted features -- [**Multiple color sets**](#color-sets): Each color set presents a unique visual theme while adhering to the same set of productive highlight rules. Every color set [can be customised](#overriding-colors-of-a-color-set). +- [**Multiple colorsets**](#color-sets): Each colorset presents a unique visual theme while adhering to the same set of productive highlight rules. Every colorset [can be customised](#overriding-colors-of-a-color-set). - **Layered backgrounds**: Most UI elements have backgrounds with different shades of the background color and have no borders. This allows for easy differentiation between the relative importance of the elements and keeps the colorscheme looking minimal. - [**Oklab color space**](https://bottosson.github.io/posts/oklab/): To truly achieve perceptually uniform variations of colors, all color modifications are done in this color space; thanks to [mini.colors](https://github.com/echasnovski/mini.colors) project for the code and idea. -- **Small number of colors**: Color sets use a small number of colors to provide distraction-free coding experience. +- **Small number of colors**: Colorsets use a small number of colors to provide distraction-free coding experience. - **Stronger highlights on important keywords**: Keywords related to control flow have stronger highlights, making it easier to quickly understand the code. @@ -51,7 +51,7 @@ Here is an example with the default config. This is optional, and only relevant ```lua require 'mellifluous'.setup({ dim_inactive = false, - color_set = 'mellifluous', + colorset = 'mellifluous', styles = { -- see :h attr-list for options. set {} for NONE, { option = true } for option comments = { italic = true }, conditionals = {}, @@ -105,14 +105,14 @@ require 'mellifluous'.setup({ ``` ### Light theme -For light theme, set `vim.opt.background` to `'light'`. This will only work on color sets that have light theme. +For light theme, set `vim.opt.background` to `'light'`. This will only work on colorsets that have light theme. -### Color sets -Non-original color sets are made to match their original version as closely as possible with the same highlight rules as mellifluous. +### Colorsets +Non-original colorsets are made to match their original version as closely as possible with the same highlight rules as mellifluous. -These color sets don't get loaded, unless you specify them in a `color_set` option, so there is no performance impact. +These colorsets don't get loaded, unless you specify them in a `colorset` option, so there is no performance impact. -Available color sets: +Available colorsets: - `mellifluous`. Dark and light, original. - `alduin`. Dark, [link to original](https://github.com/alessandroyorba/alduin). @@ -120,7 +120,7 @@ Available color sets: - `tender`. Dark, [link to original](https://github.com/jacoborus/tender.vim). - `kanagawa_dragon`. Dark, [link to original](https://github.com/rebelot/kanagawa.nvim). -#### Mellifluous color set configuration +#### Mellifluous colorset configuration Default config: ```lua @@ -137,7 +137,7 @@ The following snippet shows where and which colors can be overridden: ```lua require 'mellifluous'.setup({ - = { -- name any of the defined color sets + = { -- name any of the defined colorsets color_overrides = { dark = { -- for dark theme bg = nil, -- used for bg shades and may be used for some colorset colors @@ -156,7 +156,7 @@ require 'mellifluous'.setup({ }) ``` -To override colors for all colorsets, omit `` table. +To override colors for all colorsets, omit `` table. NOTE: parameter `colors` will have all of the colors set by the colorset, but it will not have shades. @@ -212,10 +212,10 @@ require 'mellifluous'.setup({ -- highlight overrides for specific colorset = { highlight_overrides = { - dark = function(highlighter, colors) -- dark variant of the color set + dark = function(highlighter, colors) -- dark variant of the colorset -- set highlights here (using highlighter) end, - light = function(highlighter, colors) -- light variant of the color set + light = function(highlighter, colors) -- light variant of the colorset -- set highlights here (using highlighter) end, } @@ -308,7 +308,7 @@ Type `:Mellifluous ` and see the available options. Options include: - Toggling transparency. -- Changing color set. +- Changing colorset. ## TODO - [ ] Support more plugins (contributions are welcome). diff --git a/doc/mellifluous.txt b/doc/mellifluous.txt index c60f700..4e17f71 100644 --- a/doc/mellifluous.txt +++ b/doc/mellifluous.txt @@ -7,7 +7,7 @@ Table of Contents *mellifluous-table-of-contents* 2. Installation and usage |mellifluous-installation-and-usage| 3. Configuration |mellifluous-configuration| - Light theme |mellifluous-configuration-light-theme| - - Color sets |mellifluous-configuration-color-sets| + - Colorsets |mellifluous-configuration-colorsets| - Color overrides |mellifluous-configuration-color-overrides| - Highlight overrides |mellifluous-configuration-highlight-overrides| - Available colors |mellifluous-configuration-available-colors| @@ -62,7 +62,7 @@ parts of the config can be included. >lua require 'mellifluous'.setup({ dim_inactive = false, - color_set = 'mellifluous', + colorset = 'mellifluous', styles = { -- see :h attr-list for options. set {} for NONE, { option = true } for option comments = { italic = true }, conditionals = {}, @@ -119,18 +119,18 @@ parts of the config can be included. LIGHT THEME *mellifluous-configuration-light-theme* For light theme, set `vim.opt.background` to `'light'`. This will only work on -color sets that have light theme. +colorsets that have light theme. -COLOR SETS *mellifluous-configuration-color-sets* +COLORSETS *mellifluous-configuration-colorsets* -Non-original color sets are made to match their original version as closely as +Non-original colorsets are made to match their original version as closely as possible with the same highlight rules as mellifluous. -These color sets don’t get loaded, unless you specify them in a `color_set` +These colorsets don’t get loaded, unless you specify them in a `colorset` option, so there is no performance impact. -Available color sets: +Available colorsets: - `mellifluous`. Dark and light, original. - `alduin`. Dark, link to original . @@ -139,7 +139,7 @@ Available color sets: - `kanagawa_dragon`. Dark, link to original . -MELLIFLUOUS COLOR SET CONFIGURATION ~ +MELLIFLUOUS COLORSET CONFIGURATION ~ Default config: @@ -159,7 +159,7 @@ The following snippet shows where and which colors can be overridden: >lua require 'mellifluous'.setup({ - = { -- name any of the defined color sets + = { -- name any of the defined colorsets color_overrides = { dark = { -- for dark theme bg = nil, -- used for bg shades and may be used for some colorset colors @@ -178,7 +178,7 @@ The following snippet shows where and which colors can be overridden: }) < -To override colors for all colorsets, omit `` table. +To override colors for all colorsets, omit `` table. NOTE: parameter `colors` will have all of the colors set by the colorset, but it will not have shades. @@ -238,10 +238,10 @@ The following snippet shows how highlight overrides can be defined: -- highlight overrides for specific colorset = { highlight_overrides = { - dark = function(highlighter, colors) -- dark variant of the color set + dark = function(highlighter, colors) -- dark variant of the colorset -- set highlights here (using highlighter) end, - light = function(highlighter, colors) -- light variant of the color set + light = function(highlighter, colors) -- light variant of the colorset -- set highlights here (using highlighter) end, } @@ -351,7 +351,7 @@ Type `:Mellifluous ` and see the available options. Options include: - Toggling transparency. -- Changing color set. +- Changing colorset. ============================================================================== diff --git a/lua/mellifluous/cli.lua b/lua/mellifluous/cli.lua index 2378b2c..36b8317 100644 --- a/lua/mellifluous/cli.lua +++ b/lua/mellifluous/cli.lua @@ -4,8 +4,8 @@ function M.create() local options = { toggle_transparency = 100, } - local color_sets = require('mellifluous.colors').get_color_sets_table() - options = vim.tbl_deep_extend('force', options, color_sets) + local colorsets = require('mellifluous.colors').get_colorsets_table() + options = vim.tbl_deep_extend('force', options, colorsets) local config = require('mellifluous.config').config vim.api.nvim_create_user_command('Mellifluous', function(input) @@ -15,9 +15,9 @@ function M.create() enabled = not config.transparent_background.enabled } }) - elseif color_sets[input.args] then + elseif colorsets[input.args] then require('mellifluous').setup({ - color_set = input.args + colorset = input.args }) else require('mellifluous').print_error("unrecognised cli argument: '" .. input.args .. "'") diff --git a/lua/mellifluous/color.lua b/lua/mellifluous/color.lua index 51d4106..e0c5d41 100644 --- a/lua/mellifluous/color.lua +++ b/lua/mellifluous/color.lua @@ -90,7 +90,7 @@ function color_meta:get_hsl() return hex_to_okhsl(self.hex) end -function M.color_set_to_hsl(colors) +function M.colorset_to_hsl(colors) for name, color in pairs(colors) do local okhsl = hex_to_okhsl(color.hex) okhsl.h = okhsl.h or 0 diff --git a/lua/mellifluous/colors/sets/alduin.lua b/lua/mellifluous/colors/colorsets/alduin.lua similarity index 100% rename from lua/mellifluous/colors/sets/alduin.lua rename to lua/mellifluous/colors/colorsets/alduin.lua diff --git a/lua/mellifluous/colors/sets/kanagawa_dragon.lua b/lua/mellifluous/colors/colorsets/kanagawa_dragon.lua similarity index 100% rename from lua/mellifluous/colors/sets/kanagawa_dragon.lua rename to lua/mellifluous/colors/colorsets/kanagawa_dragon.lua diff --git a/lua/mellifluous/colors/sets/mellifluous.lua b/lua/mellifluous/colors/colorsets/mellifluous.lua similarity index 94% rename from lua/mellifluous/colors/sets/mellifluous.lua rename to lua/mellifluous/colors/colorsets/mellifluous.lua index 41dee50..9cde983 100644 --- a/lua/mellifluous/colors/sets/mellifluous.lua +++ b/lua/mellifluous/colors/colorsets/mellifluous.lua @@ -1,11 +1,11 @@ local M = {} local color = require('mellifluous.color') -local color_set_name = 'mellifluous' +local colorset_name = 'mellifluous' local function get_is_neutral(mellifluous_config) local config = require('mellifluous.config').config - -- for compatibility with configs from before color set specific config was supported + -- for compatibility with configs from before colorset specific config was supported if config.neutral ~= nil then return config.neutral end @@ -14,7 +14,7 @@ end function M.get_bg_dark() local config = require('mellifluous.config').config - local mellifluous_config = config[color_set_name] + local mellifluous_config = config[colorset_name] local is_neutral = get_is_neutral(mellifluous_config) local brightness = 11.5 @@ -32,7 +32,7 @@ end function M.get_bg_light() local config = require('mellifluous.config').config - local mellifluous_config = config[color_set_name] + local mellifluous_config = config[colorset_name] local is_neutral = get_is_neutral(mellifluous_config) local brightness = 91.5 diff --git a/lua/mellifluous/colors/sets/mountain.lua b/lua/mellifluous/colors/colorsets/mountain.lua similarity index 100% rename from lua/mellifluous/colors/sets/mountain.lua rename to lua/mellifluous/colors/colorsets/mountain.lua diff --git a/lua/mellifluous/colors/sets/tender.lua b/lua/mellifluous/colors/colorsets/tender.lua similarity index 100% rename from lua/mellifluous/colors/sets/tender.lua rename to lua/mellifluous/colors/colorsets/tender.lua diff --git a/lua/mellifluous/colors/init.lua b/lua/mellifluous/colors/init.lua index 9f3d6fa..e9a7643 100644 --- a/lua/mellifluous/colors/init.lua +++ b/lua/mellifluous/colors/init.lua @@ -1,6 +1,6 @@ local M = {} -function M.get_color_sets_table() +function M.get_colorsets_table() return { mellifluous = 1, alduin = 2, @@ -20,7 +20,7 @@ local function get_color_overrides_bg_fn() local config = require('mellifluous.config').config local global_color_overrides_bg = vim.tbl_get(config, 'color_overrides', config.is_bg_dark and 'dark' or 'light', 'bg') - local color_overrides_bg_fn = vim.tbl_get(config, config.color_set, + local color_overrides_bg_fn = vim.tbl_get(config, config.colorset, 'color_overrides', config.is_bg_dark and 'dark' or 'light', 'bg') if color_overrides_bg_fn == nil then @@ -34,7 +34,7 @@ local function apply_color_overrides(colors) local config = require('mellifluous.config').config local global_color_overrides_fn = vim.tbl_get(config, 'color_overrides', config.is_bg_dark and 'dark' or 'light', 'colors') - local color_overrides_fn = vim.tbl_get(config, config.color_set, + local color_overrides_fn = vim.tbl_get(config, config.colorset, 'color_overrides', config.is_bg_dark and 'dark' or 'light', 'colors') if global_color_overrides_fn ~= nil then @@ -53,12 +53,12 @@ local function ensure_correct_color_types(colors) end end -function M.get_is_bg_dark(color_set_name) - local color_set_functions = require('mellifluous.colors.sets.' .. color_set_name) - local is_light_set_available = color_set_functions.get_bg_light ~= nil - and color_set_functions.get_colors_light ~= nil - local is_dark_set_available = color_set_functions.get_bg_dark ~= nil - and color_set_functions.get_colors_dark ~= nil +function M.get_is_bg_dark(colorset_name) + local colorset_functions = require('mellifluous.colors.colorsets.' .. colorset_name) + local is_light_set_available = colorset_functions.get_bg_light ~= nil + and colorset_functions.get_colors_light ~= nil + local is_dark_set_available = colorset_functions.get_bg_dark ~= nil + and colorset_functions.get_colors_dark ~= nil if vim.o.background == 'light' and is_light_set_available then return false @@ -67,34 +67,34 @@ function M.get_is_bg_dark(color_set_name) elseif is_light_set_available then return false else - require('mellifluous').return_error("Required color set is either incomplete or missing") + require('mellifluous').return_error("Required colorset is either incomplete or missing") end end -function M.get_ui_color_base_lightness(color_set_name, is_bg_dark) - return require('mellifluous.colors.sets.' .. color_set_name).get_ui_color_base_lightness(is_bg_dark) +function M.get_ui_color_base_lightness(colorset_name, is_bg_dark) + return require('mellifluous.colors.colorsets.' .. colorset_name).get_ui_color_base_lightness(is_bg_dark) end function M.get_colors() local config = require('mellifluous.config').config - if not M.get_color_sets_table()[config.color_set] then - require('mellifluous').return_error("Color set '" .. config.color_set .. "' not found") + if not M.get_colorsets_table()[config.colorset] then + require('mellifluous').return_error("Colorset '" .. config.colorset .. "' not found") end - local color_set_functions = require('mellifluous.colors.sets.' .. config.color_set) + local colorset_functions = require('mellifluous.colors.colorsets.' .. config.colorset) local color_overrides_bg_fn = get_color_overrides_bg_fn() - local color_set_bg + local colorset_bg if config.is_bg_dark then - color_set_bg = color_set_functions.get_bg_dark() + colorset_bg = colorset_functions.get_bg_dark() else - color_set_bg = color_set_functions.get_bg_light() + colorset_bg = colorset_functions.get_bg_light() end - local bg = color_set_bg + local bg = colorset_bg if type(color_overrides_bg_fn) == 'function' then - local overriden_bg = color_overrides_bg_fn(color_set_bg) + local overriden_bg = color_overrides_bg_fn(colorset_bg) if overriden_bg ~= nil then bg = overriden_bg end @@ -102,9 +102,9 @@ function M.get_colors() local colors if config.is_bg_dark then - colors = color_set_functions.get_colors_dark(bg) + colors = colorset_functions.get_colors_dark(bg) else - colors = color_set_functions.get_colors_light(bg) + colors = colorset_functions.get_colors_light(bg) end colors = apply_color_overrides(colors) diff --git a/lua/mellifluous/config.lua b/lua/mellifluous/config.lua index c418b91..15658ed 100644 --- a/lua/mellifluous/config.lua +++ b/lua/mellifluous/config.lua @@ -1,7 +1,7 @@ local M = {} local config = { - color_set = 'mellifluous', + colorset = 'mellifluous', plugins = { cmp = true, indent_blankline = true, @@ -74,29 +74,29 @@ local function disable_disabled() end end -local are_color_set_defaults_merged = false +local are_colorset_defaults_merged = false -local function merge_color_set_defaults() - if are_color_set_defaults_merged then +local function merge_colorset_defaults() + if are_colorset_defaults_merged then return end - are_color_set_defaults_merged = true + are_colorset_defaults_merged = true - local color_set = require('mellifluous.colors.sets.' .. config.color_set) + local colorset = require('mellifluous.colors.colorsets.' .. config.colorset) - if not color_set.get_config then + if not colorset.get_config then return end - config[config.color_set] = vim.tbl_deep_extend('force', config[config.color_set] or {}, color_set.get_config()) + config[config.colorset] = vim.tbl_deep_extend('force', config[config.colorset] or {}, colorset.get_config()) end -local function process_color_set() - config.is_bg_dark = require('mellifluous.colors').get_is_bg_dark(config.color_set) +local function process_colorset() + config.is_bg_dark = require('mellifluous.colors').get_is_bg_dark(config.colorset) config.ui_color_base_lightness = - require('mellifluous.colors').get_ui_color_base_lightness(config.color_set, config.is_bg_dark) + require('mellifluous.colors').get_ui_color_base_lightness(config.colorset, config.is_bg_dark) - merge_color_set_defaults() + merge_colorset_defaults() end -- https://www.lua.org/pil/13.4.5.html @@ -113,12 +113,12 @@ local function read_only(table) end function M.setup(user_config) - merge_color_set_defaults() + merge_colorset_defaults() config = vim.tbl_deep_extend('force', config, user_config or {}) end function M.prepare() - process_color_set() + process_colorset() disable_disabled() M.config = read_only(config) @@ -132,9 +132,9 @@ function M.set_highlight_overrides(highlighter, colors) global_highlight_overrides(highlighter, colors) end - local color_set_highlight_overrides = vim.tbl_get(M.config, M.config.color_set, 'highlight_overrides', background) or nil - if color_set_highlight_overrides then - color_set_highlight_overrides(highlighter, colors) + local colorset_highlight_overrides = vim.tbl_get(M.config, M.config.colorset, 'highlight_overrides', background) or nil + if colorset_highlight_overrides then + colorset_highlight_overrides(highlighter, colors) end end