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

refactor(palette)!: rework dayfox #285

Merged
merged 4 commits into from
Jan 5, 2023
Merged

refactor(palette)!: rework dayfox #285

merged 4 commits into from
Jan 5, 2023

Conversation

EdenEast
Copy link
Owner

@EdenEast EdenEast commented Jan 4, 2023

The old dayfox had little contrast for the colors compared to the
background. Dayfox has been completely reworked to address this issue.

Some notes about design:

  • Background blended with yellow to make it not as white on the eyes
  • Foreground is blended with magenta to contrast the yellow in the bg
  • All colors pass WCAG AA level (except orange because hard to distinct between it and yellow... colors are hard)

New

Screen Shot 2023-01-04 at 12 47 45 AM

Old

Screen Shot 2023-01-04 at 12 37 03 AM

Resolves: #282

scratch file used to make palette
local S = require("nightfox.lib.shade")
local C = require("nightfox.lib.color")

local fb = C("#282828")
local bb = C("#fafafa")
local k = C("#282828")
local r = C("#a5222f")
local g = C("#396847")
local y = C("#AC5402") -- #8D693F
local b = C("#2848a9")
local m = C("#6e33ce")
local c = C("#287980")
local w = C("#fafafa")
local o = C("#d75f00") -- #7e4725
local p = C("#a440b5")

local bg1 = bb:blend(y, 0.05)
local bg2 = bg1:brighten(-6):blend(m, 0.1)
local bg3 = bg1:brighten(-12):blend(o, 0.1)
local bg4 = bg1:brighten(-24):blend(c, 0.1)
local bg0 = bg1:brighten(-6):blend(o, 0.05)

local fg1 = fb:blend(m, 0.3)
local fg2 = fg1:brighten(12):blend(y, 0.2)
local fg3 = fg1:brighten(24):blend(y, 0.4)
local fg0 = fg1:brighten(-6):blend(b, 0.2)

local sel0 = bg1:blend(y, 0.2)
local sel1 = bg1:blend(c, 0.4)

local comment = bg1:blend(fg1, 0.75):saturate(-100):blend(y, 0.1)

local dayfox = {
  bg0 = bg0,
  bg1 = bg1,
  bg2 = bg2,
  bg3 = bg3,
  bg4 = bg4,

  fg0 = fg0,
  fg1 = fg1,
  fg2 = fg2,
  fg3 = fg3,

  sel0 = sel0,
  sel1 = sel1,

  comment = comment,
}

---------------------------------------------------------------------------

for k, v in pairs(dayfox) do
  dayfox[k] = v:to_css()
end

local current_win = vim.api.nvim_get_current_win()
local display = _G.nightfox_display
if not display then
  vim.cmd("30vnew \\[nightfox\\]")
  display = {
    win = vim.api.nvim_get_current_win(),
    buf = vim.api.nvim_get_current_buf(),
  }
  _G.nightfox_display = display
end

local contents = vim.inspect(dayfox)
vim.api.nvim_buf_set_lines(display.buf, 1, -1, 0, vim.split(contents, "\n", true))
vim.api.nvim_set_current_win(current_win)

require("nightfox").setup({
  palettes = { dayfox = dayfox },
  groups = { dayfox = { ["@field"] = { fg = "fg1" } } },
})

@EdenEast EdenEast added bug Something isn't working palette Change related color values of palette labels Jan 4, 2023
@EdenEast EdenEast self-assigned this Jan 4, 2023
The old dayfox had little contrast for the colors compared to the
background. Dayfox has been completely reworked to address this issue.

Some notes about design:

- Background blended with yellow to make it not as white on the eyes
- Foreground is blended with magenta to contrast the yellow in the bg
@oxalica
Copy link
Contributor

oxalica commented Jan 4, 2023

The new colors do look better, but the change to the hue of background makes the new one very different from the old one. Not sure if other users would consider they're still "the same theme".

@oxalica
Copy link
Contributor

oxalica commented Jan 4, 2023

except orange because hard to distinct between it and yellow... colors are hard

The orange v.s. yellow issue also happens to the current nightfox theme. I'm using orange for Enum and yellow for Struct in semantic tokens. It's kind of hard to distinguish between them.

Screenshot_20230104_193225

@EdenEast EdenEast changed the title fix(palette): rework dayfox refactor(palette): rework dayfox Jan 4, 2023
@EdenEast
Copy link
Owner Author

EdenEast commented Jan 5, 2023

the change to the hue of background makes the new one very different from the old one. Not sure if other users would consider they're still "the same theme".

I was never really happy with dayfox and it was the first light theme that I made. I am much happier with the new rework. As nightfox is very customizable if others want to remove the slight hue then can change bg1 to #ffffff and change it.

As for the orange vs yellow comment, I was referring to taking an orange and yellow color and making it pass WCAG AA becomes the same color.

@EdenEast
Copy link
Owner Author

EdenEast commented Jan 5, 2023

Changed orange from#d75f00 to #955f61. This makes it more distinguishable from yellow.

New screenshot:
Screen Shot 2023-01-04 at 7 00 24 PM

scratch file
local S = require("nightfox.lib.shade")
local C = require("nightfox.lib.color")

local fb = C("#282828")
local bb = C("#fafafa")
local k = C("#352c24")
local r = C("#a5222f")
local g = C("#396847")
local y = C("#AC5402")
local b = C("#2848a9")
local m = C("#6e33ce")
local c = C("#287980")
local w = C("#f2e9e1")
local o = C("#955f61") -- #7e4725 #955f61 #7f5539
local p = C("#a440b5")

local bg1 = bb:blend(y, 0.05)
local bg2 = bg1:brighten(-6):blend(m, 0.1)
local bg3 = bg1:brighten(-12):blend(y, 0.1)
local bg4 = bg1:brighten(-24):blend(c, 0.1)
local bg0 = bg1:brighten(-6):blend(y, 0.05)

local fg1 = fb:blend(m, 0.3)
local fg2 = fg1:brighten(12):blend(y, 0.2)
local fg3 = fg1:brighten(24):blend(y, 0.4)
local fg0 = fg1:brighten(-6):blend(b, 0.2)

local sel0 = bg1:blend(y, 0.2)
local sel1 = bg1:blend(c, 0.4)

local comment = bg1:blend(fg1, 0.75):saturate(-100):blend(y, 0.1)

local dayfox = {
  bg0 = bg0,
  bg1 = bg1,
  bg2 = bg2,
  bg3 = bg3,
  bg4 = bg4,

  fg0 = fg0,
  fg1 = fg1,
  fg2 = fg2,
  fg3 = fg3,

  sel0 = sel0,
  sel1 = sel1,

  comment = comment,
}

---------------------------------------------------------------------------

for k, v in pairs(dayfox) do
  dayfox[k] = v:to_css()
end

local current_win = vim.api.nvim_get_current_win()
local display = _G.nightfox_display
if not display then
  vim.cmd("30vnew \\[nightfox\\]")
  display = {
    win = vim.api.nvim_get_current_win(),
    buf = vim.api.nvim_get_current_buf(),
  }
  _G.nightfox_display = display
end

local contents = vim.inspect(dayfox)
vim.api.nvim_buf_set_lines(display.buf, 1, -1, 0, vim.split(contents, "\n", true))
vim.api.nvim_set_current_win(current_win)

require("nightfox").setup({
  palettes = { dayfox = dayfox },
  groups = { dayfox = { ["@field"] = { fg = "fg1" } } },
})

@EdenEast EdenEast changed the title refactor(palette): rework dayfox refactor(palette)!: rework dayfox Jan 5, 2023
@EdenEast EdenEast merged commit 4f6eff4 into main Jan 5, 2023
@EdenEast EdenEast deleted the fix/dayfox branch January 5, 2023 01:16
@JoseConseco
Copy link

JoseConseco commented Jan 6, 2023

ah, man dayfox was my fav theme. Is there way to put is back in as maybe day_old or something?
Ok I got it back after pining to commit. Still it was great theme. Here is how it looked after bit of customization.
image

@EdenEast
Copy link
Owner Author

EdenEast commented Jan 6, 2023

For those that want to use the old dayfox you can use nightfox's customization to bring it back:

local S = require("nightfox.lib.shade")
require("nightfox").setup({
  palettes = {
    dayfox = {
      black   = S.new("#1d344f", "#24476f", "#1c2f44", true),
      red     = S.new("#b95d76", "#c76882", "#ac5169", true),
      green   = S.new("#618774", "#629f81", "#597668", true),
      yellow  = S.new("#ba793e", "#ca884a", "#a36f3e", true),
      blue    = S.new("#4d688e", "#4e75aa", "#485e7d", true),
      magenta = S.new("#8e6f98", "#9f75ac", "#806589", true),
      cyan    = S.new("#6ca7bd", "#74b2c9", "#5a99b0", true),
      white   = S.new("#cdd1d5", "#cfd6dd", "#b6bcc2", true),
      orange  = S.new("#e3786c", "#e8857a", "#d76558", true),
      pink    = S.new("#d685af", "#de8db7", "#c9709e", true),

      comment = "#7f848e",

      bg0     = "#dbdbdb", -- Dark bg (status line and float)
      bg1     = "#eaeaea", -- Default bg
      bg2     = "#dbcece", -- Lighter bg (colorcolm folds)
      bg3     = "#ced6db", -- Lighter bg (cursor line)
      bg4     = "#bebebe", -- Conceal, border fg

      fg0     = "#182a40", -- Lighter fg
      fg1     = "#1d344f", -- Default fg
      fg2     = "#233f5e", -- Darker fg (status line)
      fg3     = "#2e537d", -- Darker fg (line numbers, fold colums)

      sel0    = "#e7d2be", -- Popup bg, visual selection bg
      sel1    = "#a4c1c2", -- Popup sel bg, search bg
    }
  }
})

@EdenEast EdenEast added the breaking A change that introduces a breaking change for users label Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A change that introduces a breaking change for users bug Something isn't working palette Change related color values of palette
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Low contrast of colored texts from dayfox
3 participants