Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ require('github-theme').setup({
terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal`
dim_inactive = false, -- Non focused panes set to alternative background
module_default = true, -- Default enable value for modules
set_vim_background = true, -- Automatically set vim.opt.background to 'light' or 'dark'
styles = { -- Style to be applied to different syntax groups
comments = 'NONE', -- Value is any valid attr-list value `:help attr-list`
functions = 'NONE',
Expand Down
4 changes: 4 additions & 0 deletions doc/github-nvim-theme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ options.module_default {bool} *github-nvim-theme-options.module_default*
Specifies the default value of a module that has not been overridden in the
modules table.

options.set_vim_background {bool}*github-nvim-theme-options.set_vim_background*

Automatically set `vim.opt.background` to the appropriate `'dark'` or `'light'`.


options.styles {table} *github-nvim-theme-options.styles*

Expand Down
2 changes: 2 additions & 0 deletions lua/github-theme/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ local M = { theme = 'github_dark', has_options = false }
---@field inverse? GhTheme.Config.Options.Inverse
---@field darken? GhTheme.Config.Options.Darken
---@field modules? GhTheme.Config.Options.Modules
---@field set_vim_background? boolean
local defaults = {
compile_file_suffix = '_compiled',
compile_path = util.join_paths(util.cache_home, 'github-theme'),
Expand All @@ -36,6 +37,7 @@ local defaults = {
terminal_colors = true,
dim_inactive = false,
module_default = true,
set_vim_background = true,

---A table of syntax items/groups and their corresponding styles.
---@class (exact) GhTheme.Config.Options.Styles
Expand Down
6 changes: 4 additions & 2 deletions lua/github-theme/lib/compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ function M.compile(opts)
local groups = require('github-theme.group').from(spec)
local background = spec.palette.meta.light and 'light' or 'dark'

local set_background = fmt([[vim.o.background = "%s"]], background)

local lines = {
fmt(
[[
Expand All @@ -43,10 +45,10 @@ if vim.g.colors_name then
vim.g.colors_name = nil
end
vim.o.termguicolors = true
vim.o.background = "%s"
%s
vim.g.colors_name = "%s"
]],
background,
config.options.set_vim_background and set_background or "",
opts.theme
),
}
Expand Down