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

Replace tokyonight-day with background=light #248

Closed
wants to merge 3 commits into from
Closed
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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ extra themes for Kitty, Alacritty, iTerm and Fish.

## Day

```
colorscheme tokyonight-storm
set vim.o.background=light
```


![image](https://user-images.githubusercontent.com/292349/115996270-78c6c480-a593-11eb-8ed0-7d1400b058f5.png)

## ✨ Features
Expand Down Expand Up @@ -134,7 +140,6 @@ require("tokyonight").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
style = "storm", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
transparent = false, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
Expand Down
1 change: 0 additions & 1 deletion colors/tokyonight-day.lua

This file was deleted.

25 changes: 5 additions & 20 deletions doc/tokyonight.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Table of Contents *tokyonight-table-of-contents*
- Storm |tokyonight-storm|
- Night |tokyonight-night|
- Moon |tokyonight-moon|
- Day |tokyonight-day|
- ✨ Features |tokyonight-✨-features|
- ⚡️ Requirements |tokyonight-⚡️-requirements|
- 📦 Installation |tokyonight-📦-installation|
Expand Down Expand Up @@ -45,13 +44,6 @@ MOON *tokyonight-moon*
<p class="caption">image</p>
</div>

DAY *tokyonight-day*

<div class="figure">
<img src="https://user-images.githubusercontent.com/292349/115996270-78c6c480-a593-11eb-8ed0-7d1400b058f5.png" title="fig:"/>
<p class="caption">image</p>
</div>

✨ FEATURES *tokyonight-✨-features*


Expand Down Expand Up @@ -126,7 +118,6 @@ Enable the colorscheme:
" There are also colorschemes for the different styles
colorscheme tokyonight-night
colorscheme tokyonight-storm
colorscheme tokyonight-day
colorscheme tokyonight-moon
<

Expand Down Expand Up @@ -166,14 +157,9 @@ To enable the `tokyonight` colorscheme for `Lightline`:
`colorscheme tokyonight`


The theme comes in four styles, `storm`, `moon`, a darker variant `night` and
`day`.

The **day** style will be used if:

The theme comes in four styles, `storm`, `moon`, and a darker variant, `night`.

- `{ style = "day"}` was passed to `setup(options)`
- or `vim.o.background = "light"`
A light variant will be used if `vim.o.background = "light"`.


TokyoNight will use the default options, unless you call `setup`.
Expand All @@ -182,8 +168,7 @@ TokyoNight will use the default options, unless you call `setup`.
require("tokyonight").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
style = "storm", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
style = "storm", -- The theme comes in three styles, `storm`, `moon`, and a darker variant `night`.
transparent = false, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
Expand Down Expand Up @@ -229,8 +214,8 @@ How the highlight groups are calculated:


Please refer to default values for `colors` and `highlights` for the storm
<extras/lua_tokyonight_storm.lua>, moon <extras/lua_tokyonight_moon.lua>, night
<extras/lua_tokyonight_night.lua>, day <extras/lua_tokyonight_day.lua>
<extras/lua_tokyonight_storm.lua>, moon <extras/lua_tokyonight_moon.lua> and night
<extras/lua_tokyonight_night.lua>.

Example for changing some settings and colors

Expand Down
5 changes: 2 additions & 3 deletions lua/tokyonight/colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ M.night = {
bg = "#1a1b26",
bg_dark = "#16161e",
}
M.day = M.night

M.moon = function()
local ret = {
Expand Down Expand Up @@ -99,7 +98,7 @@ function M.setup(opts)
opts = opts or {}
local config = require("tokyonight.config")

local style = config.is_day() and config.options.light_style or config.options.style
local style = config.options.style
local palette = M[style] or {}
if type(palette) == "function" then
palette = palette()
Expand Down Expand Up @@ -147,7 +146,7 @@ function M.setup(opts)
colors.hint = colors.teal

config.options.on_colors(colors)
if opts.transform and config.is_day() then
if opts.transform and vim.o.background == "light" then
util.invert_colors(colors)
end

Expand Down
8 changes: 1 addition & 7 deletions lua/tokyonight/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ local M = {}
---@field on_colors fun(colors: ColorScheme)
---@field on_highlights fun(highlights: Highlights, colors: ColorScheme)
local defaults = {
style = "storm", -- The theme comes in three styles, `storm`, a darker variant `night` and `day`
light_style = "day", -- The theme is used when the background is set to light
style = "storm", -- The theme comes in three styles, `storm`, a darker variant `night` and `moon`
transparent = false, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
Expand Down Expand Up @@ -35,7 +34,6 @@ local defaults = {
---@param highlights Highlights
---@param colors ColorScheme
on_highlights = function(highlights, colors) end,
use_background = true, -- can be light/dark/auto. When auto, background will be set to vim.o.background
}

---@type Config
Expand All @@ -51,10 +49,6 @@ function M.extend(options)
M.options = vim.tbl_deep_extend("force", {}, M.options or defaults, options or {})
end

function M.is_day()
return M.options.style == "day" or M.options.use_background and vim.o.background == "light"
end

M.setup()

return M
1 change: 0 additions & 1 deletion lua/tokyonight/extra/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ function M.setup()
local styles = {
storm = " Storm",
night = "",
day = " Day",
moon = " Moon",
}

Expand Down
2 changes: 1 addition & 1 deletion lua/tokyonight/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function M._load(style)
require("tokyonight.config").options.style = M._style
M._style = nil
end
M.load({ style = style, use_background = style == nil })
M.load({ style = style })
end

---@param opts Config|nil
Expand Down
2 changes: 1 addition & 1 deletion lua/tokyonight/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ function M.setup()

options.on_highlights(theme.highlights, theme.colors)

if config.is_day() then
if vim.o.background == "light" then
util.invert_colors(theme.colors)
util.invert_highlights(theme.highlights)
end
Expand Down