Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow mixing highlight colors #262

Open
wants to merge 1 commit into
base: v2.0
Choose a base branch
from

Conversation

soulfresh
Copy link

What does this PR do?

This update allows users to define highlight colors that are a mix of two other colors in the theme. By specifying the mix colors as color names from the theme (ex "green" or "red"), the highlight groups will adapt to match the current theme as the user switches themes. This includes switching between light and dark themes.

hl_override = {
  DiffAdd = {
    -- Set the background of diff additions to a color
    -- 50% between the green and black values defined
    -- in the theme. For light themes, this will actually
    -- be a mix between green and white colors, resulting
    -- in a light green background. Dark themes will show
    -- a dark green background.
    bg = {"green", "black", 50}
  }
}

How do I test it?

  1. Set the following in your plugin spec
  {
    "NvChad/base46",
    branch = "feat/highlight-color-mix",
    url = "https://github.com/soulfresh/base46",
    build = function()
      require("base46").load_all_highlights()
    end,
  },
  1. Add the following to your hl_override spec
  DiffAdd = {
    fg = "green",
    bg = {"green", "black", 90 },
  },
  1. Restart nvim, open a diff and switch themes

This update allows users to define highlight colors that are a mix
of two other colors in the theme. By specifying the mix colors as
color names from the theme (ex "green" or "red"), the highlight
groups will adapt to match the current theme as the user switches
themes. This includes switching between light and dark themes.

@example
```lua
hl_override = {
  DiffAdd = {
    -- Set the background of diff additions to a color
    -- 50% between the green and black values defined
    -- in the theme. For light themes, this will actually
    -- be a mix between green and white colors, resulting
    -- in a light green background. Dark themes will show
    -- a dark green background.
    bg = {"green", "black", 50}
  }
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant