Skip to content

sweet colorscheme for neovim >= 0.5.0 written in lua based on GUIX emacs sweet theme

License

Notifications You must be signed in to change notification settings

Haize-uwu/sweet.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TODO

  • add support for nvim gutter color scheme

Installation

Install via your favourite package manager
In your plugins file if using Lazyvim

-- Using Lazy
{ 
  "haize-uwu/sweet.nvim",
  lazy = false,
  priority = 1000,
  name = 'sweet',
  config = function()
      require("plugins.config.colorscheme")
      vim.cmd.colorscheme("sweet")  
  end
},
" Using Vim-Plug
Plug 'haize-uwu/sweet.nvim'
-- Using Packer
use 'haize-uwu/sweet.nvim'

Configuration

Enable theme

-- Lua
require('sweet').load()
" Vim
colorscheme sweet

Default Configuration

-- Lua
require('sweet').setup  {
    -- Main options --
    transparent = false,  -- Show/hide background
    term_colors = true, -- Change terminal color as per the selected theme style
    ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden
    cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu

    -- toggle theme style ---
    toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"
    
    -- Change code style ---
    -- Options are italic, bold, underline, none
    -- You can configure multiple style with comma separated, For e.g., keywords = 'italic,bold'
    code_style = {
        comments = 'italic',
        keywords = 'none',
        functions = 'none',
        strings = 'none',
        variables = 'none'
    },

    -- Lualine options --
    lualine = {
        transparent = false, -- lualine center bar transparency
    },

    -- Custom Highlights --
    colors = {}, -- Override default colors
    highlights = {}, -- Override highlight groups

    -- Plugins Config --
    diagnostics = { 
        undercurl = true,   -- use undercurl instead of underline for diagnostics
        background = true,    -- use background color for virtual text
    },
}

Vimscript configuration

Sweet can be configured also with Vimscript, using the global dictionary g:sweet_config. NOTE: when setting boolean values use v:true and v:false instead of 0 and 1

Example:

let g:sweet_config = {
  \ 'style': 'deep',
  \ 'toggle_style_key': '<leader>ts',
  \ 'ending_tildes': v:true,
  \ 'diagnostics': {
    \ 'darker': v:false,
    \ 'background': v:false,
  \ },
\ }
colorscheme sweet

Customization

Example custom colors and Highlights config

require('sweet').setup {
  colors = {
    bright_orange = "#ff8800",    -- define a new color
    green = '#00ffaa',            -- redefine an existing color
  },
  highlights = {
    ["@keyword"] = {fg = '$green'},
    ["@string"] = {fg = '$bright_orange', bg = '#00ff00', fmt = 'bold'},
    ["@function"] = {fg = '#0000ff', sp = '$cyan', fmt = 'underline,italic'},
    ["@function.builtin"] = {fg = '#0059ff'}
  }
}

Note that TreeSitter keywords have been changed after neovim version 0.8 and onwards. TS prefix is trimmed and lowercase words should be used separated with '.'

The old way before neovim 0.8 looks like this. For all keywords see this file from line 133 to 257

require('sweet').setup {
  colors = {
    bright_orange = "#ff8800",    -- define a new color
    green = '#00ffaa',            -- redefine an existing color
  },
  highlights = {
    TSKeyword = {fg = '$green'},
    TSString = {fg = '$bright_orange', bg = '#00ff00', fmt = 'bold'},
    TSFunction = {fg = '#0000ff', sp = '$cyan', fmt = 'underline,italic'},
    TSFuncBuiltin = {fg = '#0059ff'}
  }
}

Plugins Configuration

Enable lualine

To Enable the sweet theme for Lualine, specify theme as sweet:

require('lualine').setup {
  options = {
    theme = 'sweet'
    -- ... your lualine config
  }
}

Plugins Supported

Reference

This theme is based on the onedark.nvim theme from navarasu and the GUIX emacs-sweet-theme

Contributing

Feel free to contribute and modify as needed.

License

MIT

About

sweet colorscheme for neovim >= 0.5.0 written in lua based on GUIX emacs sweet theme

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages