-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(config):
options.darken.floats
is not used
Problem: `options.darken.floats` isn't used anywhere and `NormalFloat` is unconditionally set to `spec.bg0` (darker background). Solution: Only set `bg` of `NormalFloat` to `bg0` if `options.darken.floats` is `true`, otherwise, set it to `bg1` (default background). Problem: Floating windows are darkened unconditionally and `options.darken.floats` appears to be documented as being `true` by default (see `options.darken` section of Usage.md), however, the actual default in `config.lua` is `false`. In README.md, the default value is properly documented as being `false`. Solution: Change the default value of `options.darken.floats` to `true`. Update the documented default to `true`. This is not a breaking change because this is currently the default behavior.
- Loading branch information
Showing
6 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
local assert = require('luassert') | ||
local t_util = require('github-theme._test.util') | ||
local C = require('github-theme.lib.color') | ||
|
||
describe('config > options > darken', function() | ||
before_each(function() | ||
require('github-theme.config').reset() | ||
end) | ||
|
||
describe('> floats', function() | ||
for _, variant in ipairs(require('github-theme.palette').themes) do | ||
-- TODO: see #324 | ||
local _it = variant:find('high[-_]*contrast') and pending or it | ||
|
||
_it(('should be enabled by default (%s)'):format(variant), function() | ||
require('github-theme').setup() | ||
vim.cmd.colorscheme({ args = { variant } }) | ||
local normal_float = t_util.get_hl('NormalFloat') | ||
local normal = t_util.get_hl('Normal') | ||
|
||
assert.is_true(require('github-theme.config').options.darken.floats) | ||
assert.are.not_equal(normal_float.bg, normal.bg) | ||
assert( | ||
C(('#%x'):format(normal_float.bg)):luminance() | ||
< C(('#%x'):format(normal.bg)):luminance(), | ||
('expected `bg` of `NormalFloat` (#%x) to be darker than `bg` of `Normal` (#%x)'):format( | ||
normal_float.bg, | ||
normal.bg | ||
) | ||
) | ||
end) | ||
|
||
it(('should be disabled when set to `false` (%s)'):format(variant), function() | ||
require('github-theme').setup({ options = { darken = { floats = false } } }) | ||
vim.cmd.colorscheme({ args = { variant } }) | ||
local normal_float = t_util.get_hl('NormalFloat') | ||
local normal = t_util.get_hl('Normal') | ||
|
||
assert.is_false(require('github-theme.config').options.darken.floats) | ||
assert.are.equal(normal_float.bg, normal.bg) | ||
end) | ||
end | ||
end) | ||
end) |