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

Update extra colors #33

Open
rxtsel opened this issue May 4, 2024 · 15 comments · May be fixed by #64
Open

Update extra colors #33

rxtsel opened this issue May 4, 2024 · 15 comments · May be fixed by #64

Comments

@rxtsel
Copy link

rxtsel commented May 4, 2024

Color files in extra, like kitty, still use tokyonight colors.

@rodrigolj
Copy link

@craftzdog as an alternative, could you provide us with instructions on how should we run the generator for the extra colorschemes so we can export our extra styles locally?

@craftzdog
Copy link
Owner

you can look into tokyonight's extra folder:

https://github.com/folke/tokyonight.nvim/tree/main/lua/tokyonight/extra

@rodrigolj
Copy link

Oh, so from what I understand, you don't use the Solarized Osaka colors as terminal colors? You use Tokyo Night on the terminal and Solarized Osaka is just for Neovim?

@rxtsel
Copy link
Author

rxtsel commented Aug 24, 2024

I made this adaptation for now: https://github.com/rxtsel/dot/blob/f92e1a4df849e69b664c1349140274af1bfa1dd9/.config/kitty/kitty.conf#L17

@ZeroEcks
Copy link

ZeroEcks commented Sep 1, 2024

I had a look and it turns out the extras generation is completely broken. I would recommend deleting it for now imo.

It seems the last thing needed to get this working is to map the unused variables to the correct value. For example bg_visual, green1, bg_dark, dark3, fg_dark, etc. are not used in solarized osaka and end up creating unusable themes unless they are updated to use the correct names.

I would love if someone had the time to make this work though, I had a play and ended up with this code for the time being.

local M = {}

-- map of plugin name to plugin extension
--- @type table<string, {ext:string, url:string, label:string}>
-- stylua: ignore
M.extras = {
  kitty = {ext = "conf", url = "https://sw.kovidgoyal.net/kitty/conf.html", label = "Kitty"},
  fish = {ext = "fish", url = "https://fishshell.com/docs/current/index.html", label = "Fish"},
  fish_themes = {ext = "theme", url = "https://fishshell.com/docs/current/interactive.html#syntax-highlighting", label = "Fish Themes"},
  alacritty = {ext = "yml", url = "https://github.com/alacritty/alacritty", label = "Alacritty"},
  wezterm = {ext = "toml", url = "https://wezfurlong.org/wezterm/config/files.html", label = "WezTerm"},
  tmux = {ext = "tmux", url = "https://github.com/tmux/tmux/wiki", label = "Tmux"},
  xresources = {ext = "Xresources", url = "https://wiki.archlinux.org/title/X_resources", label = "Xresources"},
  xfceterm = {ext = "theme", url = "https://docs.xfce.org/apps/terminal/advanced", label = "Xfce Terminal"},
  foot = {ext = "ini", url = "https://codeberg.org/dnkl/foot", label = "Foot"},
  tilix = {ext = "json", url = "https://github.com/gnunn1/tilix", label = "Tilix"},
  -- ERROR: this line crashes the program, probably would fix if the other issues are fixed though.
  -- iterm = {ext = "itermcolors", url = "https://iterm2.com/", label = "iTerm"},
  lua = {ext = "lua", url = "https://www.lua.org", label = "Lua Table for testing"},
  sublime = {ext = "tmTheme", url = "https://www.sublimetext.com/docs/themes", label = "Sublime Text"},
  delta = {ext = "gitconfig", url = "https://github.com/dandavison/delta", label = "Delta"},
  terminator = {ext = "conf", url = "https://gnome-terminator.readthedocs.io/en/latest/config.html", label = "Terminator"},
  prism = {ext = "js", url = "https://prismjs.com", label = "Prism"},
  windows_terminal = {ext = "json", url = "https://aka.ms/terminal-documentation", label = "Windows Terminal"},
  zathura = {ext = "zathurarc", url = "https://pwmt.org/projects/zathura/", label = "Zathura"},
  dunst = {ext = "dunstrc", url = "https://dunst-project.org/", label = "Dunst"},
  gitui = {ext = "ron", url = "https://github.com/extrawurst/gitui", label = "GitUI"},
}

local function write(str, fileName)
  print("[write] extra/" .. fileName)
  vim.fn.mkdir(vim.fs.dirname("extras/" .. fileName), "p")
  local file = io.open("extras/" .. fileName, "w")
  file:write(str)
  file:close()
end

function M.read_file(file)
  local fd = assert(io.open(file, "r"))
  ---@type string
  local data = fd:read("*a")
  fd:close()
  return data
end

function M.write_file(file, contents)
  local fd = assert(io.open(file, "w+"))
  fd:write(contents)
  fd:close()
end

function M.docs()
  local file = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p:h:h:h:h") .. "/README.md"
  local tag = "extras"
  local pattern = "(<%!%-%- " .. tag .. ":start %-%->).*(<%!%-%- " .. tag .. ":end %-%->)"
  local readme = M.read_file(file)
  local lines = {}
  local names = vim.tbl_keys(M.extras)
  table.sort(names)
  for _, name in ipairs(names) do
    local info = M.extras[name]
    table.insert(lines, "- [" .. info.label .. "](" .. info.url .. ") ([" .. name .. "](extras/" .. name .. "))")
  end
  readme = readme:gsub(pattern, "%1\n" .. table.concat(lines, "\n") .. "\n%2")
  M.write_file(file, readme)
end

function M.setup()
  M.docs()
  local config = require("solarized-osaka.config")

  -- map of style to style name
  -- Remove the unused styles
  local styles = {
    night = "",
    day = " Day",
  }

  for extra, info in pairs(M.extras) do
    package.loaded["solarized-osaka.extra." .. extra] = nil
    local plugin = require("solarized-osaka.extra." .. extra)
    -- Enable the background for day and night? I think this is needed.
    for style, style_name in pairs(styles) do
      if style == "night" then
        vim.o.background = "dark"
      elseif style == "day" then
        vim.o.background = "light"
      end
      config.setup({ style = style, use_background = "auto" })
      local colors = require("solarized-osaka.colors").setup({ transform = true })
      local fname = extra .. "/solarized_osaka_" .. style .. "." .. info.ext
      colors["_upstream_url"] = "https://github.com/craftzdog/solarized-osaka.nvim/raw/main/extras/" .. fname
      colors["_style_name"] = "Solarized Osaka" .. style_name
      write(plugin.generate(colors), fname)
    end
  end
end

return M

@stribor14
Copy link

Any news on this front? Help needed? I'm interested in using this colorscheme outside of neovim

@ZeroEcks
Copy link

If you can sit down and remap all the values from this scheme to the existing values, it would work. I don't have the design or aesthetic sense to do this however. Maybe give it a play though, it's probably not too hard!

@stribor14
Copy link

As far as I can see, this repo was a clone of folkes tokyo theme and a lot of unused code is still left in-place. His stuff is published under Apache2 license so we could reuse a lot of stuff.

Filling the rest of the colors could be done by following @craftzdog 's figma file he linked to in readme

I think the code as-is should be also cleaned in process (i.e., solarized-osaka doesn't have flavors night, storm, etc).

As for testing, here I would blindly trust folke when reusing his scripts. I would test it in few tools (e.g. tmux, wezterm, kitty) and for the rest 🤷

@redoxahmii
Copy link
Collaborator

The issue with this is you have to test with every application where it could work.

I only use Kitty and Tmux from the listed options but the issue with those would be that when using nvim inside them the colors for status lines start blending too much.

These colors are generated from build script similar to how folke's works.

t_2024_11_23_06_18

Keeping the different colors for status line helps at least differentiate between which is which.

t_2024_11_23_06_22

I have tested with creating a build script that replicates these colors to some extent thanks to @ZeroEcks code snippet provided.

If these colors are acceptable to some sense i can look into it further to implement this similar to how it functions for folke where you just run the script once and also remove all the legacy code left.

@ZeroEcks
Copy link

ZeroEcks commented Nov 23, 2024 via email

@redoxahmii
Copy link
Collaborator

The "hidden items" part is actually not affected by the theme applied to the terminal but instead by the nvim theme.
It is a little too dim for my taste too tbh but i think it can be changed to something a little brighter.

t_2024_11_23_07_45

I would prefer it to be this so you could actually read what is going on but no idea if @craftzdog approves of this.
Anything lighter than this is the same as the default and the other provided base option becomes same as the color of the files in the neo-tree.
If this is approved i will include this part in my pull request that i have made for the dashboard.

@redoxahmii
Copy link
Collaborator

redoxahmii commented Nov 23, 2024

@craftzdog for these to work properly instead of doing every single file individually and changing the values we can use the same variables and reassign them different colors and that would save a lot of time in making this work.

Do tell which would be preferred cause editing every single file and adding those values is a lot of work while it can easily be solved to generate proper colors by just adding reassigning colors to match the conventions already written.

This is also same how it is done in tokyonight for deprecated colors like fg_sidebar and it is reassigned.

it should also resolve this issue.

@redoxahmii
Copy link
Collaborator

For the time being all the values have been reassigned and I've made a separate file in case the maintainer wants to change those values later so it's easier to know what to change.

  1. I've also added to it a neat configuration when working with repository where you can define what colorscheme and plugins neovim environment loads and it uses mini-hipatterns to display the colors next to them similar to how it was implemented in tokyonight.
  2. Added a build script that you can run to remake all the extras if colors are changed.
  3. All extras have been updated to use the correct colors and all the tokyonight extras have been removed.

The only thing i couldn't figure out was the lua script written for iterm and i tested around a lot but failed with that so if someone understands their syntax of config better it would be appreciated if they help.

This is my fork of this repo you can clone it and than git checkout generator to test if it works properly for everyone and can also test the extras that are created with the associated softwares they are made for.

Do inform me what you think and then when the maintainer responds i'll make a pull request.

For easier testing you can add this to your existing lazy.nvim configuration.

require("lazy").setup({
  dev = {
    path = "~/Code/Neovim/",
  }
})

Clone the repo in that path and change your solarized-osaka.nvim setup function with this

return {
    "craftzdog/solarized-osaka.nvim",
    lazy = true,
    dev = true,
    opts = {
      styles = {
        sidebars = "transparent",
        floats = "transparent",
      },
    },
  }

if you want to do it the old school way you can just change the solarized-osaka.nvim config with this :

{
    "Redoxahmii/solarized-osaka.nvim",
    lazy = true,
    branch = "generator",
    opts = {
      styles = {
        sidebars = "transparent",
        floats = "transparent",
      },
    },
  }

@rxtsel
Copy link
Author

rxtsel commented Dec 15, 2024

if you want to do it the old school way you can just change the solarized-osaka.nvim config with this :

{
    "Redoxahmii/solarized-osaka.nvim",
    lazy = true,
    branch = "generator",
    opts = {
      styles = {
        sidebars = "transparent",
        floats = "transparent",
      },
    },
  }

Hi @redoxahmii, I'm trying to clone from your fork of the generator branch and I'm getting this error:

image

@redoxahmii
Copy link
Collaborator

This is the direct link.
Maybe try make the R in Redoxahmii to lowercase it causes issues sometimes.
@rxtsel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants