catppuccin / nvim

🍨 Soothing pastel theme for (Neo)vim
MIT License
5.7k stars 257 forks source link

[Question] Rust closure character is gray, how to change it? #132

Closed HATTER-LONG closed 2 years ago

HATTER-LONG commented 2 years ago

Rust closure character is gray, it's very hard to see, how to change it ?

image

after double ||:

image

in vscode always nice:

image
pocco81 commented 2 years ago

Heya!

@HATTER-LONG we recently released Catppuccin v0.2.0, and with that came along some new palettes based on the original catppuccin we all know and love that you way want to try :)

Let me know if that fixes your problem!

HATTER-LONG commented 2 years ago

@Pocco81 thx for your reply!

I update catppuccin to latest, some color has changed. but closure character still a gray color, just like this:

image

here some my cfg, please tell me if have other way to change it:

function config.catppuccin()
    local colors = require("catppuccin.api.colors").get_colors() -- fetch colors with API
    require("catppuccin").remap({
        Visual = { fg = colors.flamingo, bg = colors.black3 },
        VisualNOS = { fg = colors.flamingo, bg = colors.black3 },
    })
    require("catppuccin").setup({
        transparent_background = false,
        term_colors = false,
        styles = {
            comments = "italic",
            functions = "italic,bold",
            keywords = "italic",
            strings = "NONE",
            variables = "NONE",
        },
        integrations = {
            treesitter = true,
            native_lsp = {
                enabled = true,
                virtual_text = {
                    errors = "italic",
                    hints = "italic",
                    warnings = "italic",
                    information = "italic",
                },
                underlines = {
                    errors = "underline",
                    hints = "underline",
                    warnings = "underline",
                    information = "underline",
                },
            },
            lsp_trouble = true,
            lsp_saga = true,
            gitgutter = false,
            gitsigns = true,
            telescope = true,
            nvimtree = { enabled = true, show_root = true },
            which_key = true,
            indent_blankline = { enabled = true, colored_indent_levels = false },
            dashboard = true,
            neogit = false,
            vim_sneak = false,
            fern = false,
            barbar = false,
            bufferline = true,
            markdown = true,
            lightspeed = false,
            ts_rainbow = true,
            hop = true,
        },
    })
end

-- install with packer.nvim
ui["catppuccin/nvim"] = {
    opt = false,
    as = "catppuccin",
    config = conf.catppuccin,
}
pocco81 commented 2 years ago

Ok I've dug into problem and it seems that this is how it's supposed to be. According to treesitter the closure character is linked to the TSPunctHighlight group. This highlights group is also attached to things like brackets, commas, etc. so it's not feasible to change it to another color since that would alter the overall look of the theme.

There are, however, two solutions to this:

1. Custom Treesitter highlight captures

https://github.com/nvim-treesitter/nvim-treesitter#highlight

2. Editing the highlight group in your own config

local cp = require("catppuccin.core.palettes.init").get_palette()

require("catppuccin").setup({
    custom_highlights = {
        TSPunctBracket = { fg = cp.sky, style = "NONE" },
    }
})

The custom_highlights setting is a new feature introduced by recent changes to the plugin. If you have any questions please refer to #178.

HATTER-LONG commented 2 years ago

thx for your reply. it's useful to me 👍