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

feat(platforms): add generation for platform files #161

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DOD-101
Copy link

@DOD-101 DOD-101 commented Jan 5, 2025

I have ported Tokonights extra-generation system to work for nordic.nvim.

I have adjusted the code to make it more well suited for nordic.nvim, mainly simplifying it, since nordic.nvim doesn't have mutliple flavors, but reversing this to work for multiple flavors in the future wouldn't be a significant challange.

Why?

This would allow for easier creation of additional platforms, as well as help reduce inconsistencies between the different handwritten themes.

To-Do:

The one problem currently is that we would need to find a way to convert the hex color values to work for iTerm2 and Konsole since they use other formats.

However, I don't think this will be a significant blocker.

  • Port the generation system
  • Port all existing themes to the new system
    • Create conversion functions for iTerm2 and Konsole
  • Add CI to update /platforms on each addition / change of one of the template files
  • Update docs

Note on Licensing

Since Tokyonight is licensed under Apache License 2.0 we need to make sure we are in compliance with their License. I have added a note to the top of platforms/init.lua, but I am not sure if this is all that we require.

It might be a good idea to add a NOTICE file.

@DOD-101
Copy link
Author

DOD-101 commented Jan 5, 2025

I'm more than willing to implement all the steps listed above, but I would first like to get this approved, before I take the time to implement the rest.

@5-pebbles
Copy link
Collaborator

5-pebbles commented Jan 5, 2025

I am in support of this PR, I think it would make updating the color palate much easier and help keep thing in sync. It would also make vetting new extras faster (no more checking hex codes).

I think the simplest approach for CI would be to just add the generation to the docs_and_format workflow.

If I remember right, we used to have color conversion stuff in utils but then I deleted it all... I will see if I can fish that back up.

Edit: It looks like we still have some of them. I am not near a device with a working nvim config, but something like this should work:

local U = require("nordic.utils")
local r, g, b = U.hex_to_rgb(hex)
return string.format("%d,%d,%d", r, g, b)

I would define that function in the individual themes, because I doubt we will find iTerm2's system anywhere else.

What do you think @AlexvZyl?

@5-pebbles 5-pebbles requested a review from AlexvZyl January 5, 2025 19:06
lua/nordic/platforms/foot.lua Outdated Show resolved Hide resolved
lua/nordic/platforms/init.lua Outdated Show resolved Hide resolved
lua/nordic/platforms/init.lua Outdated Show resolved Hide resolved
lua/nordic/utils.lua Outdated Show resolved Hide resolved
platforms.sh Show resolved Hide resolved
This is based heavily off of the tokyonight extras-generation system.

Co-authored-by: Owen Friedman  <[email protected]>
Also adjust their doc strings slightly.
Copy link
Collaborator

@5-pebbles 5-pebbles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great!

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 this pull request may close these issues.

2 participants